home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / obero / oberon_lib.lha / oberon-a / source1.lha / source / Amiga / Dos.mod < prev    next >
Text File  |  1994-08-08  |  87KB  |  2,578 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Dos.mod $
  4.   Description: Interface to dos.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:52:02 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. MODULE Dos;
  23.  
  24. (*
  25. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  26. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  27. ** $V- OvflChk       $Z- ZeroVars
  28. *)
  29.  
  30. IMPORT E := Exec, T := Timer, U := Utility, SYS := SYSTEM;
  31.  
  32.  
  33. (*
  34. **      Missing include files:
  35. **
  36. **            dos/stdio.h (uses C multiple parameters)
  37. *)
  38.  
  39. (**-- Pointer declarations ---------------------------------------------*)
  40.  
  41. TYPE
  42.  
  43.   DatePtr*                  = CPOINTER TO Date;
  44.   FileInfoBlockPtr*         = CPOINTER TO FileInfoBlock;
  45.   InfoDataPtr*              = CPOINTER TO InfoData;
  46.   DateTimePtr*              = CPOINTER TO DateTime;
  47.   AChainPtr*                = CPOINTER TO AChain;
  48.   AnchorPathPtr*            = CPOINTER TO AnchorPath;
  49.   DosEnvecPtr*              = BPOINTER TO DosEnvec;
  50.   FileSysStartupMsgPtr*     = BPOINTER TO FileSysStartupMsg;
  51.   DeviceNodePtr*            = CPOINTER TO DeviceNode;
  52.   NotifyRequestPtr*         = CPOINTER TO NotifyRequest;
  53.   NotifyMessagePtr*         = CPOINTER TO NotifyMessage;
  54.   CSourcePtr*               = CPOINTER TO CSource;
  55.   RDArgsPtr*                = CPOINTER TO RDArgs;
  56.   RecordLockPtr*            = CPOINTER TO RecordLock;
  57.   LocalVarPtr*              = CPOINTER TO LocalVar;
  58.   ExAllDataPtr*             = CPOINTER TO ExAllData;
  59.   ExAllControlPtr*          = CPOINTER TO ExAllControl;
  60.   ProcessPtr*               = CPOINTER TO Process;
  61.   FileHandlePtr*            = BPOINTER TO FileHandle;
  62.   DosPacketPtr*             = CPOINTER TO DosPacket;
  63.   StandardPacketPtr*        = CPOINTER TO StandardPacket;
  64.   TaskArrayPtr*             = BPOINTER TO TaskArray;
  65.   RootNodePtr*              = CPOINTER TO RootNode;
  66.   ErrorStringPtr*           = CPOINTER TO ErrorString;
  67.   DosLibraryPtr*            = CPOINTER TO DosLibrary;
  68.   CliProcListPtr*           = CPOINTER TO CliProcList;
  69.   DosInfoPtr*               = BPOINTER TO DosInfo;
  70.   SegmentPtr*               = CPOINTER TO Segment;
  71.   CommandLineInterfacePtr*  = BPOINTER TO CommandLineInterface;
  72.   DeviceListPtr*            = BPOINTER TO DeviceList;
  73.   DevInfoPtr*               = BPOINTER TO DevInfo;
  74.   AssignListPtr*            = CPOINTER TO AssignList;
  75.   DosListPtr*               = BPOINTER TO DosList;
  76.   DevProcPtr*               = CPOINTER TO DevProc;
  77.   FileLockPtr*              = BPOINTER TO FileLock;
  78.   ProcessId*                = E.MsgPortPtr; (* Points to Process.msgPort *)
  79.   DosListNodePtr*           = CPOINTER TO DosListNode;
  80.  
  81. (*
  82. **      $VER: dos.h 36.27 (5.4.92)
  83. **
  84. **      Standard header for AmigaDOS
  85. *)
  86.  
  87. CONST
  88.  
  89.   name    * = "dos.library";
  90.  
  91. (* Predefined Amiga DOS global constants *)
  92.  
  93.   TRUE  * = -1;
  94.   FALSE * = 0;
  95.  
  96. (* Mode parameter to Open() *)
  97.   modeOldFile        * = 1005;   (* Open existing file read/write
  98.                                   * positioned at beginning of file. *)
  99.   modeNewFile        * = 1006;   (* Open freshly created file (delete
  100.                                   * old file) read/write, exclusive lock. *)
  101.   modeReadWrite      * = 1004;   (* Open old file w/shared lock,
  102.                                   * creates file if doesn't exist. *)
  103.  
  104. (* Relative position to Seek() *)
  105.   offsetBeginning    * = -1;      (* relative to Begining Of File *)
  106.   offsetCurrent      * =  0;      (* relative to Current file position *)
  107.   offsetEnd          * =  1;      (* relative to End Of File    *)
  108.  
  109.   bitsPerByte         * = 8;
  110.   bytesPerLong        * = 4;
  111.   bitsPerLong         * = 32;
  112.   maxInt              * = 7FFFFFFFH;
  113.   minInt              * = 80000000H;
  114.  
  115. (* Passed as type to Lock() *)
  116.   sharedLock         * = -2;     (* File is readable by others *)
  117.   accessRead         * = -2;     (* Synonym *)
  118.   exclusiveLock      * = -1;     (* No other access allowed    *)
  119.   accessWrite        * = -1;     (* Synonym *)
  120.  
  121. TYPE
  122.  
  123. (*
  124. ** Note that the type name has been changed from DateStamp to Date to
  125. ** avoid a name clash with the DateStamp() function.
  126. *)
  127.  
  128.   Date* = RECORD
  129.     days  * : LONGINT;           (* Number of days since Jan. 1, 1978 *)
  130.     minute* : LONGINT;           (* Number of minutes past midnight *)
  131.     tick  * : LONGINT;           (* Number of ticks past minute *)
  132.   END; (* Date *)
  133.  
  134. CONST
  135.  
  136.   ticksPerSecond     * = 50;   (* Number of ticks in one second *)
  137.  
  138. TYPE
  139.  
  140. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  141.   FileInfoBlock* = RECORD
  142.     diskKey     * : LONGINT;
  143.     dirEntryType* : LONGINT;
  144.                             (* Type of Directory. If < 0, then a plain file.
  145.                              * If > 0 a directory *)
  146.     fileName    * : ARRAY 108 OF CHAR;
  147.                             (* Null terminated. Max 30 chars used for now *)
  148.     protection  * : SET;    (* bit mask of protection, rwxd are 3-0.      *)
  149.     entryType   * : LONGINT;
  150.     size        * : LONGINT;    (* Number of bytes in file *)
  151.     numBlocks   * : LONGINT;    (* Number of blocks in file *)
  152.     date        * : Date;  (* Date file last changed *)
  153.     comment     * : ARRAY 80 OF CHAR;
  154.                           (* Null terminated comment associated with file *)
  155.  
  156.     (* Note: the following fields are not supported by all filesystems.  *)
  157.     (* They should be initialized to 0 sending an ACTION_EXAMINE packet. *)
  158.     (* When Examine() is called, these are set to 0 for you.             *)
  159.     (* AllocDosObject() also initializes them to 0.                      *)
  160.     ownerUID    * : E.UWORD;      (* owner's UID *)
  161.     ownerGID    * : E.UWORD;      (* owner's GID *)
  162.  
  163.     reserved    * :  ARRAY 32 OF CHAR;
  164.   END; (* FileInfoBlock *)
  165.  
  166. CONST
  167.  
  168. (* fib stands for FileInfoBlock *)
  169.  
  170. (* Bit definitions *)
  171. (* Regular RWED bits are 0 == allowed. *)
  172. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  173. (* Group and Other permissions are not directly handled by the filesystem *)
  174.   fibOtrRead    * = 15;       (* Other: file is readable *)
  175.   fibOtrWrite   * = 14;       (* Other: file is writable *)
  176.   fibOtrExecute * = 13;       (* Other: file is executable *)
  177.   fibOtrDelete  * = 12;       (* Other: prevent file from being deleted *)
  178.   fibGrpRead    * = 11;       (* Group: file is readable *)
  179.   fibGrpWrite   * = 10;       (* Group: file is writable *)
  180.   fibGrpExecute * = 9;        (* Group: file is executable *)
  181.   fibGrpDelete  * = 8;        (* Group: prevent file from being deleted *)
  182.  
  183.   fibScript     * = 6;        (* program is a script (execute) file *)
  184.   fibPure       * = 5;        (* program is reentrant and rexecutable *)
  185.   fibArchive    * = 4;        (* cleared whenever file is changed *)
  186.   fibReadProt   * = 3;        (* ignored by old filesystem *)
  187.   fibWriteProt  * = 2;        (* ignored by old filesystem *)
  188.   fibExecute    * = 1;        (* ignored by system, used by Shell *)
  189.   fibDelete     * = 0;        (* prevent file from being deleted *)
  190.  
  191. (* Standard maximum length for an error string from fault.  However, most *)
  192. (* error strings should be kept under 60 characters if possible.  Don't   *)
  193. (* forget space for the header you pass in. *)
  194.   faultMax      * = 82;
  195.  
  196. TYPE
  197.  
  198. (* All BCPL data must be long word aligned.  BCPL pointers are the long word
  199.  *  address (i.e byte address divided by 4 (>>2)) *)
  200.  
  201.   BPTR* = SYS.BPTR;                      (* Long word pointer *)
  202.   BSTR* = BPOINTER TO ARRAY 256 OF CHAR; (* Long word pointer to BCPL string *)
  203.  
  204. (* BCPL strings have a length in the first byte and then the characters.
  205.  * For example:  s[0]=3 s[1]=S s[2]=Y s[3]=S                             *)
  206.  
  207. (* returned by Info(), must be on a 4 byte boundary *)
  208.   InfoData* = RECORD
  209.     numSoftErrors* : LONGINT;      (* number of soft errors on disk *)
  210.     unitNumber   * : LONGINT;      (* Which unit disk is (was) mounted on *)
  211.     diskState    * : LONGINT;      (* See defines below *)
  212.     numBlocks    * : LONGINT;      (* Number of blocks on disk *)
  213.     numBlocksUsed* : LONGINT;      (* Number of block in use *)
  214.     bytesPerBlock* : LONGINT;
  215.     diskType     * : LONGINT;      (* Disk Type code *)
  216.     volumeNode   * : DeviceListPtr;(* BCPL pointer to volume node *)
  217.     inUse        * : LONGINT;      (* Flag, zero if not in use *)
  218.   END; (* InfoData *)
  219.  
  220. CONST
  221.  
  222. (* id stands for InfoData *)
  223.         (* Disk states *)
  224.   idWriteProtect * = 80;    (* Disk is write protected *)
  225.   idValidating   * = 81;    (* Disk is currently being validated *)
  226.   idValidated    * = 82;    (* Disk is consistent and writeable *)
  227.  
  228.         (* Disk types *)
  229. (* idInter* use international case comparison routines for hashing *)
  230.   idNoDiskPresent      * = -1;
  231.   idUnreadableDisk     * = 42414400H;   (* 'BAD\0' *)
  232.   idDosDisk            * = 444F5300H;   (* 'DOS\0' *)
  233.   idFfsDisk            * = 444F5301H;   (* 'DOS\1' *)
  234.   idInterDosDisk       * = 444F5302H;   (* 'DOS\2' *)
  235.   idInterFfsDisk       * = 444F5303H;   (* 'DOS\3' *)
  236.   idNotReallyDos       * = 4E444F53H;   (* 'NDOS'  *)
  237.   idKickstartDisk      * = 4B49434BH;   (* 'KICK'  *)
  238.   idMsdosDisk          * = 4D534400H;   (* 'MSD\0' *)
  239.  
  240. (* Errors from IoErr(), etc. *)
  241.   errorNoFreeStore              * = 103;
  242.   errorTaskTableFull            * = 105;
  243.   errorBadTemplate              * = 114;
  244.   errorBadNumber                * = 115;
  245.   errorRequiredArgMissing       * = 116;
  246.   errorKeyNeedsArg              * = 117;
  247.   errorTooManyArgs              * = 118;
  248.   errorUnmatchedQuotes          * = 119;
  249.   errorLineTooLong              * = 120;
  250.   errorFileNotObject            * = 121;
  251.   errorInvalidResidentLibrary   * = 122;
  252.   errorNoDefaultDir             * = 201;
  253.   errorObjectInUse              * = 202;
  254.   errorObjectExists             * = 203;
  255.   errorDirNotFound              * = 204;
  256.   errorObjectNotFound           * = 205;
  257.   errorBadStreamName            * = 206;
  258.   errorObjectTooLarge           * = 207;
  259.   errorActionNotKnown           * = 209;
  260.   errorInvalidComponentName     * = 210;
  261.   errorInvalidLock              * = 211;
  262.   errorObjectWrongType          * = 212;
  263.   errorDiskNotValidated         * = 213;
  264.   errorDiskWriteProtected       * = 214;
  265.   errorRenameAcrossDevices      * = 215;
  266.   errorDirectoryNotEmpty        * = 216;
  267.   errorTooManyLevels            * = 217;
  268.   errorDeviceNotMounted         * = 218;
  269.   errorSeekError                * = 219;
  270.   errorCommentTooBig            * = 220;
  271.   errorDiskFull                 * = 221;
  272.   errorDeleteProtected          * = 222;
  273.   errorWriteProtected           * = 223;
  274.   errorReadProtected            * = 224;
  275.   errorNotADosDisk              * = 225;
  276.   errorNoDisk                   * = 226;
  277.   errorNoMoreEntries            * = 232;
  278. (* added for 1.4 *)
  279.   errorIsSoftLink               * = 233;
  280.   errorObjectLinked             * = 234;
  281.   errorBadHunk                  * = 235;
  282.   errorNotImplemented           * = 236;
  283.   errorRecordNotLocked          * = 240;
  284.   errorLockCollision            * = 241;
  285.   errorLockTimeout              * = 242;
  286.   errorUnlockError              * = 243;
  287.  
  288. (* error codes 303-305 are defined in dosasl.h *)
  289.  
  290. (* These are the return codes used by convention by AmigaDOS commands *)
  291. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  292.   returnOk                         * = 0;  (* No problems, success *)
  293.   returnWarn                       * = 5;  (* A warning only *)
  294.   returnError                      * = 10;  (* Something wrong *)
  295.   returnFail                       * = 20;  (* Complete or severe failure*)
  296.  
  297. (* Bit numbers that signal you that a user has issued a break *)
  298.   sigBreakCtrlC  * = 12;
  299.   sigBreakCtrlD  * = 13;
  300.   sigBreakCtrlE  * = 14;
  301.   sigBreakCtrlF  * = 15;
  302.  
  303. (* Values returned by SameLock() *)
  304.   lockDifferent         * = -1;
  305.   lockSame              * = 0;
  306.   lockSameVolume        * = 1;       (* locks are on same volume *)
  307.   lockSameHandler       * = lockSameVolume;
  308. (* lockSameHandler was a misleading name, def kept for src compatibility *)
  309.  
  310. (* types for ChangeMode() *)
  311.   changeLock    * = 0;
  312.   changeFH      * = 1;
  313.  
  314. (* Values for MakeLink() *)
  315.   linkHard      * = 0;
  316.   linkSoft      * = 1;       (* softlinks are not fully supported yet *)
  317.  
  318. (* values returned by ReadItem *)
  319.   itemEqual     * = -2;              (* "=" Symbol *)
  320.   itemItemError * = -1;              (* error *)
  321.   itemNothing   * = 0;               (* *N, ;, endstreamch *)
  322.   itemUnQuoted  * = 1;               (* unquoted item *)
  323.   itemQuoted    * = 2;               (* quoted item *)
  324.  
  325. (* types for AllocDosObject/FreeDosObject *)
  326.   fileHandle         * = 0;       (* few people should use this *)
  327.   exAllControl       * = 1;       (* Must be used to allocate this! *)
  328.   fib                * = 2;       (* useful *)
  329.   stdPkt             * = 3;       (* for doing packet-level I/O *)
  330.   cli                * = 4;       (* for shell-writers, etc *)
  331.   rdArgs             * = 5;       (* for ReadArgs if you pass it in *)
  332.  
  333. (*
  334. **      $VER: datetime.h 36.7 (12.7.90)
  335. **
  336. **      Date and time header for AmigaDOS
  337. *)
  338.  
  339. (*
  340.  *      Data structures and equates used by the V1.4 DOS functions
  341.  * StrtoDate() and DatetoStr()
  342.  *)
  343.  
  344. CONST
  345.  
  346. (* You need this much room for each of the DateTime strings: *)
  347.   lenDatString  * = 16;
  348.  
  349. TYPE
  350.   DatString * = ARRAY lenDatString OF CHAR;
  351.   DatStringPtr * = CPOINTER TO DatString;
  352.  
  353. (* --------- String/Date structures etc *)
  354.   DateTime* = RECORD (Date)   (* DOS Date *)
  355.     format * : E.UBYTE;       (* controls appearance of datStrDate *)
  356.     flags  * : E.BSET;        (* see BITDEF's below *)
  357.     strDay * : DatStringPtr;  (* day of the week string *)
  358.     strDate* : DatStringPtr;  (* date string *)
  359.     strTime* : DatStringPtr;  (* time string *)
  360.   END; (* DateTime *)
  361.  
  362. CONST
  363.  
  364. (*      flags for datFlags *)
  365.  
  366.   dtSubst      * = 0;               (* substitute Today, Tomorrow, etc. *)
  367.   dtFuture     * = 1;               (* day of the week is in future *)
  368.  
  369. (*
  370.  *      date format values
  371.  *)
  372.  
  373.   formatDos     * = 0;               (* dd-mmm-yy *)
  374.   formatInt     * = 1;               (* yy-mm-dd  *)
  375.   formatUSA     * = 2;               (* mm-dd-yy  *)
  376.   formatCDN     * = 3;               (* dd-mm-yy  *)
  377.   formatMax     * = formatCDN;
  378.  
  379. (*
  380. **      $VER: dosasl.h 36.16 (2.5.91)
  381. **
  382. **      Pattern-matching structure definitions
  383. *)
  384.  
  385. (***********************************************************************
  386. ************************ PATTERN MATCHING ******************************
  387. ************************************************************************
  388.  
  389. * structure expected by MatchFirst, MatchNext.
  390. * Allocate this structure and initialize it as follows:
  391. *
  392. * Set apBreakBits to the signal bits (CDEF) that you want to take a
  393. * break on, or NULL, if you don't want to convenience the user.
  394. *
  395. * If you want to have the FULL PATH NAME of the files you found,
  396. * allocate a buffer at the END of this structure, and put the size of
  397. * it into apStrlen.  If you don't want the full path name, make sure
  398. * you set apStrlen to zero.  In this case, the name of the file, and stats
  399. * are available in the apInfo, as per usual.
  400. *
  401. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  402. * You should check the return value each time (see below) and take the
  403. * appropriate action, ultimately calling MatchEnd() when there are
  404. * no more files and you are done.  You can tell when you are done by
  405. * checking for the normal AmigaDOS return code errornomoreENTRIES.
  406. *
  407. *)
  408.  
  409. TYPE
  410.  
  411.   AnchorPath* = RECORD
  412.     base      * : AChainPtr;   (* pointer to first anchor *)
  413.     last      * : AChainPtr;   (* pointer to last anchor *)
  414.     breakBits * : SET;         (* Bits we want to break on *)
  415.     foundBreak* : SET;         (* Bits we broke on. Also returns errorBREAK *)
  416.     flags     * : E.BSET;      (* New use for extra word. *)
  417.     reserved  * : E.BYTE;
  418.     strlen    * : INTEGER;     (* This is what apLength used to be *)
  419.     info      * : FileInfoBlock;
  420.     buf       * : ARRAY 256 OF CHAR;
  421.                                (* Buffer for path name, allocated by user *)
  422.   END; (* AnchorPath *)
  423.  
  424.  
  425. CONST
  426.  
  427.   apDoWild     * = 0;       (* User option ALL *)
  428.   apItsWild    * = 1;       (* Set by MatchFirst, used by MatchNext  *)
  429.                             (* Application can test apItsWild,  too  *)
  430.                             (* (means that there's a wildcard        *)
  431.                             (* in the pattern after calling          *)
  432.                             (* MatchFirst).                          *)
  433.   apDoDir      * = 2;       (* Bit is SET if a DIR node should be *)
  434.                             (* entered. Application can RESET this *)
  435.                             (* bit after MatchFirst/MatchNext to AVOID *)
  436.                             (* entering a dir. *)
  437.   apDidDir     * = 3;       (* Bit is SET for an "expired" dir node. *)
  438.   apNoMemErr   * = 4;       (* Set on memory error *)
  439.   apDoDot      * = 5;       (* If set, allow conversion of '.' to *)
  440.                             (* CurrentDir *)
  441.   apDirChanged * = 6;       (* apcurrent->anLock changed *)
  442.                             (* since last MatchNext call *)
  443.   apFollowHLinks* = 7;      (* follow hardlinks on DODIR - defaults   *)
  444.                             (* to not following hardlinks on a DODIR. *)
  445.  
  446. TYPE
  447.  
  448.   AChain* = RECORD
  449.     child  * : AChainPtr;
  450.     parent * : AChainPtr;
  451.     lock   * : FileLockPtr;
  452.     info   * : FileInfoBlock;
  453.     flags  * : E.BSET;
  454.     string * : ARRAY 256 OF CHAR;
  455.   END; (* AChain *)
  456.  
  457. CONST
  458.  
  459.   ddPatternBit * = 0;
  460.   ddExaminedBit* = 1;
  461.   ddCompleted  * = 2;
  462.   ddAllBit     * = 3;
  463.   ddSingle     * = 4;
  464.  
  465. (*
  466.  * Constants used by wildcard routines, these are the pre-parsed tokens
  467.  * referred to by pattern match.  It is not necessary for you to do
  468.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  469.  *)
  470.  
  471.   pAny          * = 80H;    (* Token for '*' or '#?  *)
  472.   pSingle       * = 81H;    (* Token for '?' *)
  473.   pOrStart      * = 82H;    (* Token for '(' *)
  474.   pOrNext       * = 83H;    (* Token for '|' *)
  475.   pOeEnd        * = 84H;    (* Token for ')' *)
  476.   pNot          * = 85H;    (* Token for '~' *)
  477.   pNotEnd       * = 86H;    (* Token for *)
  478.   pNotClass     * = 87H;    (* Token for '^' *)
  479.   pClass        * = 88H;    (* Token for '[]' *)
  480.   pRepBeg       * = 89H;    (* Token for '[' *)
  481.   pRepEnd       * = 8AH;    (* Token for ']' *)
  482.   pStop         * = 8BH;    (* token to force end of evaluation *)
  483.  
  484. (* Values for anStatus, NOTE: These are the actual bit numbers *)
  485.  
  486.   complexBit    * = 1;       (* Parsing complex pattern *)
  487.   examineBit    * = 2;       (* Searching directory *)
  488.  
  489. (*
  490.  * Returns from MatchFirst(), MatchNext()
  491.  * You can also get dos error returns, such as errornomoreENTRIES,
  492.  * these are in the dos.h file.
  493.  *)
  494.  
  495.   errorBufferOverflow  * = 303;     (* User or internal buffer overflow *)
  496.   errorBreak           * = 304;     (* A break character was received *)
  497.   errorNotExecutable   * = 305;     (* A file has E bit cleared *)
  498.  
  499.  
  500. (*
  501. **      $VER: doshunks.h 36.9 (2.6.92)
  502. **
  503. **      Hunk definitions for object and load modules.
  504. *)
  505.  
  506. CONST
  507.  
  508. (* hunk types *)
  509.   hunkUnit      * = 999;
  510.   hunkName      * = 1000;
  511.   hunkCode      * = 1001;
  512.   hunkData      * = 1002;
  513.   hunkBSS       * = 1003;
  514.   hunkReloc32   * = 1004;
  515.   hunkAbsReloc32 * = hunkReloc32;
  516.   hunkReloc16   * = 1005;
  517.   hunkRelReloc16 * = hunkReloc16;
  518.   hunkReloc8    * = 1006;
  519.   hunkRelReloc8 * = hunkReloc8;
  520.   hunkExt       * = 1007;
  521.   hunkSymbol    * = 1008;
  522.   hunkDebug     * = 1009;
  523.   hunkEnd       * = 1010;
  524.   hunkHeader    * = 1011;
  525.  
  526.   hunkOverlay   * = 1013;
  527.   hunkBreak     * = 1014;
  528.  
  529.   hunkDRel32    * = 1015;
  530.   hunkDRel16    * = 1016;
  531.   hunkDRel8     * = 1017;
  532.  
  533.   hunkLib       * = 1018;
  534.   hunkIndex     * = 1019;
  535.  
  536. (*
  537.  * Note: V37 LoadSeg uses 1015 (hunkDRel32) by mistake.  This will continue
  538.  * to be supported in future versions, since hunkDRel32 is illegal in load files
  539.  * anyways.  Future versions will support both 1015 and 1020, though anything
  540.  * that should be usable under V37 should use 1015.
  541.  *)
  542.   hunkReloc32Short * = 1020;
  543.  
  544. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles relReloc32).*)
  545.   hunkRelReloc32 * = 1021;
  546.   hunkAbsReloc16 * = 1022;
  547.  
  548. (*
  549.  * Any hunks that have the hunkAdvisory bit set will be ignored if they
  550.  * aren't understood.  When ignored, they're treated like hunkDebug hunks.
  551.  * NOTE: this handling of hunkAdvisory started as of V39 dos.library!  If
  552.  * lading such executables is attempted under <V39 dos, it will fail with a
  553.  * bad hunk type.
  554.  *)
  555.   hunkAdvisory * = 29;
  556.   hunkChip * = 30;
  557.   hunkFast * = 31;
  558.  
  559.  
  560. (* hunkext sub-types *)
  561.   extSymb       * = 0;       (* symbol table *)
  562.   extDef        * = 1;       (* relocatable definition *)
  563.   extAbs        * = 2;       (* Absolute definition *)
  564.   extRes        * = 3;       (* no longer supported *)
  565.   extRef32      * = 129;     (* 32 bit reference to symbol *)
  566.   extAbsRef32   * = extRef32;
  567.   extCommon     * = 130;     (* 32 bit reference to COMMON block *)
  568.   extAbsCommon  * = extCommon;
  569.   extRef16      * = 131;     (* 16 bit reference to symbol *)
  570.   extRelRef16   * = extRef16;
  571.   extRef8       * = 132;     (*  8 bit reference to symbol *)
  572.   extRelRef8    * = extRef8;
  573.   extDExt32     * = 133;     (* 32 bit data releative reference *)
  574.   extDExt16     * = 134;     (* 16 bit data releative reference *)
  575.   extDExt8      * = 135;     (*  8 bit data releative reference *)
  576.  
  577. (* These are to support some of the '020 and up modes that are rarely used *)
  578.   extRelRef32   * = 136;     (* 32 bit PC-relative reference to symbol *)
  579.   extRelCommon  * = 137;     (* 32 bit PC-relative reference to COMMON block *)
  580.  
  581. (* for completeness... All 680x0's support this *)
  582.   extAbsRef16   * = 138;     (* 16 bit absolute reference to symbol *)
  583.  
  584. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  585.   extAbsRef8    * = 139;     (* 8 bit absolute reference to symbol *)
  586.  
  587.  
  588. (*
  589. **      $VER: filehandler.h 36.6 (9.8.92)
  590. **
  591. **      device and file handler specific code for AmigaDOS
  592. *)
  593.  
  594. TYPE
  595.  
  596. (* The disk "environment" is a longword array that describes the
  597.  * disk geometry.  It is variable sized, with the length at the beginning.
  598.  * Here are the constants for a standard geometry.
  599.  *)
  600.  
  601.   DosEnvec* = RECORD
  602.     tableSize     * : E.ULONG; (* Size of Environment vector *)
  603.     sizeBlock     * : E.ULONG; (* in longwords: standard value is 128 *)
  604.     secOrg        * : E.ULONG; (* not used; must be 0 *)
  605.     surfaces      * : E.ULONG; (* # of heads (surfaces). drive specific *)
  606.     sectorPerBlock* : E.ULONG; (* not used; must be 1 *)
  607.     blocksPerTrack* : E.ULONG; (* blocks per track. drive specific *)
  608.     reserved      * : E.ULONG; (* DOS reserved blocks at start of partition. *)
  609.     preAlloc      * : E.ULONG; (* DOS reserved blocks at end of partition *)
  610.     interleave    * : E.ULONG; (* usually 0 *)
  611.     lowCyl        * : E.ULONG; (* starting cylinder. typically 0 *)
  612.     highCyl       * : E.ULONG; (* max cylinder. drive specific *)
  613.     numBuffers    * : E.ULONG; (* Initial # DOS of buffers.  *)
  614.     bufMemType    * : E.ULONG; (* type of mem to allocate for buffers *)
  615.     maxTransfer   * : E.ULONG; (* Max number of bytes to transfer at a time *)
  616.     mask          * : SET;     (* Address Mask to block out certain memory *)
  617.     bootPri       * : LONGINT; (* Boot priority for autoboot *)
  618.     dosType       * : E.ULONG; (* ASCII (HEX) string showing filesystem type;
  619.                                 * 444F5300H is old filesystem,
  620.                                 * 444F5301H is fast file system *)
  621.     baud          * : E.ULONG; (* Baud rate for serial handler *)
  622.     control       * : E.ULONG; (* Control word for handler/filesystem *)
  623.     bootBlocks    * : E.ULONG; (* Number of blocks containing boot code *)
  624.  
  625.   END; (* DosEnvec *)
  626.  
  627. CONST
  628.  
  629. (* these are the offsets into the array *)
  630. (* deTableSize is set to the number of longwords in the table minus 1 *)
  631.  
  632.   deTableSize   * = 0;       (* minimum value is 11 (includes NumBuffers) *)
  633.   deSizeBlock   * = 1;       (* in longwords: standard value is 128 *)
  634.   deSecOrg      * = 2;       (* not used; must be 0 *)
  635.   deNumHeads    * = 3;       (* # of heads (surfaces). drive specific *)
  636.   deSecsPerBlk  * = 4;       (* not used; must be 1 *)
  637.   deBlksPerTrack* = 5;       (* blocks per track. drive specific *)
  638.   deReservedBlks* = 6;       (* unavailable blocks at start.  usually 2 *)
  639.   dePrefac      * = 7;       (* not used; must be 0 *)
  640.   deInterleave  * = 8;       (* usually 0 *)
  641.   deLowCyl      * = 9;       (* starting cylinder. typically 0 *)
  642.   deUpperCyl    * = 10;      (* max cylinder.  drive specific *)
  643.   deNumBuffers  * = 11;      (* starting # of buffers.  typically 5 *)
  644.   deMemBufType  * = 12;      (* type of mem to allocate for buffers. *)
  645.   deBufMemType  * = 12;      (* same as above, better name
  646.                               * 1 is public, 3 is chip, 5 is fast *)
  647.   deMaxTransfer * = 13;      (* Max number bytes to transfer at a time *)
  648.   deMask        * = 14;      (* Address Mask to block out certain memory *)
  649.   deBootPri     * = 15;      (* Boot priority for autoboot *)
  650.   deDosType     * = 16;      (* ASCII (HEX) string showing filesystem type;
  651.                               * 444F5300H is old filesystem,
  652.                               * 444F5301H is fast file system *)
  653.   deBaud        * = 17;      (* Baud rate for serial handler *)
  654.   deControl     * = 18;      (* Control word for handler/filesystem *)
  655.   deBootBlocks  * = 19;      (* Number of blocks containing boot code *)
  656.  
  657. TYPE
  658.  
  659. (* The file system startup message is linked into a device node's startup
  660. ** field.  It contains a pointer to the above environment, plus the
  661. ** information needed to do an exec OpenDevice().
  662. *)
  663.   FileSysStartupMsg* = RECORD
  664.     unit   * : E.ULONG;     (* exec unit number for this device *)
  665.     device * : BSTR;        (* null terminated bstring to the device name *)
  666.     environ* : DosEnvecPtr; (* ptr to environment table (see above) *)
  667.     flags  * : SET;         (* flags for OpenDevice() *)
  668.   END; (* FileSysStartupMsg *)
  669.  
  670.  
  671. (* The include file "libraries/dosextens.h" has a DeviceList structure.
  672.  * The "device list" can have one of three different things linked onto
  673.  * it.  Dosextens defines the structure for a volume.  dltDirectory
  674.  * is for an assigned directory.  The following structure is for
  675.  * a dos "device" (dltDevice).
  676. *)
  677.  
  678.   DeviceNode* = RECORD
  679.     next     * : DeviceNodePtr; (* singly linked list *)
  680.     type     * : E.ULONG;       (* always 0 for dos "devices" *)
  681.     task     * : ProcessId;     (* standard dos "task" field.  If this is
  682.                                  * null when the node is accesses, a task
  683.                                  * will be started up *)
  684.     lock     * : FileLockPtr;   (* not used for devices -- leave null *)
  685.     handler  * : BSTR;          (* filename to loadseg (if seglist is null) *)
  686.     stackSize* : E.ULONG;       (* stacksize to use when starting task *)
  687.     priority * : LONGINT;       (* task priority when starting task *)
  688.     startup  * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
  689.     segList  * : BPTR;          (* code to run to start new task (if necessary).
  690.                                  * if null then dnHandler will be loaded. *)
  691.     globalVec* : BPTR;          (* BCPL global vector to use when starting
  692.                                  * a task.  -1 means that dnSegList is not
  693.                                  * for a bcpl program, so the dos won't
  694.                                  * try and construct one.  0 tell the
  695.                                  * dos that you obey BCPL linkage rules,
  696.                                  * and that it should construct a global
  697.                                  * vector for you.
  698.                                  *)
  699.     name     * : BSTR;          (* the node name, e.g. '\3','D','F','3' *)
  700.   END; (* DeviceNode *)
  701.  
  702.  
  703. (*
  704. **      $VER: notify.h 36.8 (29.8.90)
  705. **
  706. **      dos notification definitions
  707. *)
  708.  
  709. CONST
  710.  
  711. (* use of Class and code is discouraged for the time being - we might want
  712.    to change things *)
  713. (* --- NotifyMessage Class ---------------------------------------------- *)
  714.   notifyClass   * = 40000000H;
  715.  
  716. (* --- NotifyMessage Codes ---------------------------------------------- *)
  717.   notifyCode    * = 1234H;
  718.  
  719. TYPE
  720.  
  721. (* Sent to the application if sendMESSAGE is specified.                    *)
  722.  
  723.   NotifyMessage* = RECORD (E.Message)
  724.     class       * : E.ULONG;
  725.     code        * : E.UWORD;
  726.     nReq        * : NotifyRequestPtr; (* don't modify the request! *)
  727.     doNotTouch  * : E.ULONG;          (* like it says!  For use by handlers *)
  728.     doNotTouch2 * : E.ULONG;          (* ditto *)
  729.   END; (* NotifyMessage *)
  730.  
  731. (* Do not modify or reuse the notifyrequest while active.                 *)
  732. (* note: the first LONG of nrData has the length transfered               *)
  733.  
  734.   NotifyRequest* = RECORD
  735.     name    *  : E.STRPTR;
  736.     fullName*  : E.STRPTR;             (* set by dos - don't touch *)
  737.     userData*  : E.ULONG;              (* for applications use *)
  738.     flags   *  : SET;
  739.     task    *  : E.TaskPtr;            (* for sendSignal *)
  740.     (** port * : E.MsgPortPtr;         (* for sendMessage *)
  741.      *
  742.      * port occupies the same space as task (a C union). Access via:
  743.      * SYS.VAL (E.MsgPortPtr, NotifyRequest.task)
  744.      *)
  745.     signalNum* : E.UBYTE;              (* for sendSignal *)
  746.     pad      * : ARRAY 3 OF E.UBYTE;
  747.     reserved*  : ARRAY 4 OF E.ULONG;   (* leave 0 for now *)
  748.  
  749.     (* internal use by handlers *)
  750.     msgCount*  : E.ULONG;              (* # of outstanding msgs *)
  751.     handler *  : E.MsgPortPtr;         (* handler sent to (for EndNotify) *)
  752.   END; (* NotifyRequest *)
  753.  
  754. CONST
  755.  
  756. (* --- NotifyRequest Flags ------------------------------------------------ *)
  757.  
  758. (* bit numbers *)
  759.   nrSendMessage       * = 0;
  760.   nrSendSignal        * = 1;
  761.   nrWaitReply         * = 3;
  762.   nrNotifyInitial     * = 4;
  763.  
  764. (* do NOT set or remove nrMagic!  Only for use by handlers! *)
  765.   nrMagic              * = 31;
  766.  
  767. (* Flags reserved for private use by the handler: *)
  768.   nrHandlerFlags       * = {16 .. 31};
  769.  
  770.  
  771. (*
  772. **      $VER: rdargs.h 36.6 (12.7.90)
  773. **
  774. **      ReadArgs() structure definitions
  775. *)
  776.  
  777. (**********************************************************************
  778.  *
  779.  * The CSource data structure defines the input source for "ReadItem()"
  780.  * as well as the ReadArgs call.  It is a publicly defined structure
  781.  * which may be used by applications which use code that follows the
  782.  * conventions defined for access.
  783.  *
  784.  * When passed to the dos.library functions, the value passed as
  785.  * struct *CSource is defined as follows:
  786.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  787.  *      else                    Use CSource for input character stream
  788.  *
  789.  * The following two pseudo-code routines define how the CSource structure
  790.  * is used:
  791.  *
  792.  * long csReadChar( CSource : CSourcePtr )
  793.  * {
  794.  *      if ( CSource == 0 )     return ReadChar();
  795.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  796.  *      return CSource->Buffer[ CSource->CurChr++ ];
  797.  * }
  798.  *
  799.  * BOOL csUnReadChar( CSource : CSourcePtr )
  800.  * {
  801.  *      if ( CSource == 0 )     return UnReadChar();
  802.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  803.  *      CSource->CurChr--;
  804.  *      return TRUE;
  805.  * }
  806.  *
  807.  * To initialize a struct CSource, you set csource->csBuffer to
  808.  * a string which is used as the data source, and set csLength to
  809.  * the number of characters in the string.  Normally csCurChr should
  810.  * be initialized to ZERO, or left as it was from prior use as
  811.  * a CSource.
  812.  *
  813.  **********************************************************************)
  814.  
  815. TYPE
  816.  
  817.   CSource* = RECORD
  818.     buffer* : E.STRPTR;
  819.     length* : LONGINT;
  820.     curChr* : LONGINT;
  821.   END; (* CSource *)
  822.  
  823. (**********************************************************************
  824.  *
  825.  * The RDArgs data structure is the input parameter passed to the DOS
  826.  * ReadArgs() function call.
  827.  *
  828.  * The rdaSource structure is a CSource as defined above;
  829.  * if rdasource.csBuffer is non-null, rdaSource is used as the input
  830.  * character stream to parse, else the input comes from the buffered STDIN
  831.  * calls ReadChar/UnReadChar.
  832.  *
  833.  * rdaDAList is a private address which is used internally to track
  834.  * allocations which are freed by FreeArgs().  This MUST be initialized
  835.  * to NULL prior to the first call to ReadArgs().
  836.  *
  837.  * The rdaBuffer and rdaBufSiz fields allow the application to supply
  838.  * a fixed-size buffer in which to store the parsed data.  This allows
  839.  * the application to pre-allocate a buffer rather than requiring buffer
  840.  * space to be allocated.  If either rdaBuffer or rdaBufSiz is NULL,
  841.  * the application has not supplied a buffer.
  842.  *
  843.  * rdaExtHelp is a text string which will be displayed instead of the
  844.  * template string, if the user is prompted for input.
  845.  *
  846.  * rdaFlags bits control how ReadArgs() works.  The flag bits are
  847.  * defined below.  Defaults are initialized to ZERO.
  848.  *
  849.  **********************************************************************)
  850.  
  851. TYPE
  852.  
  853.   RDArgs* = RECORD
  854.     source * : CSource;     (* Select input source *)
  855.     daList * : LONGINT;     (* PRIVATE. *)
  856.     buffer * : E.STRPTR;    (* Optional string parsing space. *)
  857.     bufSiz * : LONGINT;     (* Size of rdaBuffer (0..n) *)
  858.     extHelp* : E.STRPTR;    (* Optional extended help *)
  859.     flags  * : SET;         (* Flags for any required control *)
  860.   END; (* RDArgs *)
  861.  
  862. CONST
  863.  
  864.   rdaStdIn     * = 0;       (* Use "STDIN" rather than "COMMAND LINE" *)
  865.   rdaNoAlloc   * = 1;       (* If set, do not allocate extra string space.*)
  866.   rdaNoPrompt  * = 2;       (* Disable reprompting for string input. *)
  867.  
  868. (**********************************************************************
  869.  * Maximum number of template keywords which can be in a template passed
  870.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  871.  **********************************************************************)
  872.   maxTemplateItems     * = 100;
  873.  
  874. (**********************************************************************
  875.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  876.  * an errorLineTooLONG.  These two limitations are due to stack
  877.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  878.  **********************************************************************)
  879.   maxMultiArgs          * = 128;
  880.  
  881.  
  882. (*
  883. **      $VER: record.h 36.5 (12.7.90)
  884. **
  885. **      include file for record locking
  886. *)
  887.  
  888. CONST
  889.  
  890. (* Modes for LockRecord/LockRecords() *)
  891.   recExclusive         * = 0;
  892.   recExclusiveImmed    * = 1;
  893.   recShared            * = 2;
  894.   recSharedImmed       * = 3;
  895.  
  896. TYPE
  897.  
  898. (* struct to be passed to LockRecords()/UnLockRecords() *)
  899.  
  900.   RecordLock* = RECORD
  901.     fh    * : FileHandlePtr; (* filehandle *)
  902.     offset* : E.ULONG;       (* offset in file *)
  903.     length* : E.ULONG;       (* length of file to be locked *)
  904.     mode  * : E.ULONG;       (* Type of lock *)
  905.   END; (* RecordLock *)
  906.  
  907.  
  908. (*
  909. **      $VER: var.h 36.11 (2.6.92)
  910. **
  911. **      include file for dos local and environment variables
  912. *)
  913.  
  914. TYPE
  915.  
  916. (* the structure in the prLocalVars list *)
  917. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  918. (* future releases!  The list should be left in alphabetical order, and *)
  919. (* may have multiple entries with the same name but different types.    *)
  920.  
  921.   LocalVar* = RECORD (E.Node)
  922.     flags* : E.WSET;
  923.     value* : E.STRPTR;
  924.     len  * : E.ULONG;
  925.   END; (* LocalVar *)
  926.  
  927. CONST
  928.  
  929. (*
  930.  * The LocalVar.flags bits are available to the application.  The unused
  931.  * LocalVar.pri bits are reserved for system use.
  932.  *)
  933.  
  934. (* bit definitions for LocalVar.type: *)
  935.   lvVar                 * = 0;       (* an variable *)
  936.   lvAlias               * = 1;       (* an alias *)
  937. (* to be or'ed into LocalVar.type: *)
  938.   lvIgnore              * = 7;       (* ignore this entry on GetVar, etc *)
  939.  
  940. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  941. (* bit defs to be OR'ed with the type: *)
  942. (* item will be treated as a single line of text unless binaryVAR is used *)
  943.   gvGlobalOnly        * = 8;
  944.   gvLocalOnly         * = 9;
  945.   gvBinaryVar         * = 10;              (* treat variable as binary *)
  946.   gvDontNullTerm      * = 11;              (* only with gvBinaryVar *)
  947.  
  948. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  949. (* this causes SetVar to affect ENVARC: as well as ENV:.        *)
  950.   gvSaveVar           * = 12;              (* only with gvGlobalVar *)
  951.  
  952.  
  953. (*
  954. **      $VER: dostags.h 36.11 (29.4.91)
  955. **
  956. **      Tag definitions for all Dos routines using tags
  957. *)
  958.  
  959. CONST
  960.  
  961. (*****************************************************************************)
  962. (* definitions for the System() call *)
  963.  
  964.   sysDummy      * = U.tagUser + 32;
  965.   sysInput      * = sysDummy + 1; (* specifies the input filehandle  *)
  966.   sysOutput     * = sysDummy + 2; (* specifies the output filehandle *)
  967.   sysAsynch     * = sysDummy + 3; (* run asynch, close input/output on exit(!) *)
  968.   sysUserShell  * = sysDummy + 4; (* send to user shell instead of boot shell *)
  969.   sysCustomShell* = sysDummy + 5; (* send to a specific shell (data is name) *)
  970.  
  971. (*****************************************************************************)
  972. (* definitions for the CreateNewProc() call *)
  973. (* you MUST specify one of npSeglist or npEntry.  All else is optional. *)
  974.  
  975.   npDummy       * = U.tagUser + 1000;
  976.   npSeglist     * = npDummy + 1; (* seglist of code to run for the process  *)
  977.   npFreeSeglist * = npDummy + 2; (* free seglist on exit - only valid for   *)
  978.                                  (* for npSeglist.  Default is TRUE.       *)
  979.   npEntry       * = npDummy + 3; (* entry point to run - mutually exclusive *)
  980.                                  (* with npSeglist! *)
  981.   npInput       * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
  982.   npOutput      * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
  983.   npCloseInput  * = npDummy + 6; (* close input filehandle on exit          *)
  984.                                  (* default TRUE                            *)
  985.   npCloseOutput * = npDummy + 7; (* close output filehandle on exit         *)
  986.                                  (* default TRUE                            *)
  987.   npError       * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
  988.   npCloseError  * = npDummy + 9; (* close error filehandle on exit          *)
  989.                                  (* default TRUE                            *)
  990.   npCurrentDir  * = npDummy + 10; (* lock - default is parent's current dir  *)
  991.   npStackSize   * = npDummy + 11; (* stacksize for process - default 4000    *)
  992.   npName        * = npDummy + 12; (* name for process - default "New Process"*)
  993.   npPriority    * = npDummy + 13; (* priority - default same as parent       *)
  994.   npConsoleTask * = npDummy + 14; (* consoletask - default same as parent    *)
  995.   npWindowPtr   * = npDummy + 15; (* window ptr - default is same as parent  *)
  996.   npHomeDir     * = npDummy + 16; (* home directory - default curr home dir  *)
  997.   npCopyVars    * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
  998.   npCli         * = npDummy + 18; (* create cli structure - default FALSE    *)
  999.   npPath        * = npDummy + 19; (* path - default is copy of parents path  *)
  1000.                                   (* only valid if a cli process!    *)
  1001.   npCommandName * = npDummy + 20; (* commandname - valid only for CLI        *)
  1002.   npArguments   * = npDummy + 21; (* cstring of arguments - passed with str in a0, length in d0.  *)
  1003.                                   (* (copied and freed on exit.)  Default is 0-length NULL ptr.   *)
  1004.                                   (* NOTE: not operational until V37 - see BIX/TechNotes for      *)
  1005.                                   (* more info/workaround.  In V36, the registers were random.    *)
  1006.                                   (* You must NEVER use npArguments with a npInput of NULL.       *)
  1007. (* FIX! should this be only for cli's? *)
  1008.   npNotifyOnDeath* = npDummy + 22; (* notify parent on death - default FALSE  *)
  1009.                                    (* Not functional yet. *)
  1010.   npSynchronous * = npDummy + 23; (* don't return until process finishes -   *)
  1011.                                   (* default FALSE.                          *)
  1012.                                   (* Not functional yet. *)
  1013.   npExitCode    * = npDummy + 24; (* code to be called on process exit       *)
  1014.   npExitData    * = npDummy + 25; (* optional argument for npEndCode rtn -  *)
  1015.                                   (* default NULL                           *)
  1016.  
  1017.  
  1018. (*****************************************************************************)
  1019. (* tags for AllocDosObject *)
  1020.  
  1021.   adoDummy     * = U.tagUser + 2000;
  1022.   adoFhMode    * = adoDummy + 1;
  1023.                               (* for type dosFILEHANDLE only            *)
  1024.                               (* sets up FH for mode specified.
  1025.                                  This can make a big difference for buffered
  1026.                                  files.                                  *)
  1027.        (* The following are for dosCLI *)
  1028.        (* If you do not specify these, dos will use it's preferred values *)
  1029.        (* which may change from release to release.  The BPTRs to these   *)
  1030.        (* will be set up correctly for you.  Everything will be zero,     *)
  1031.        (* except cliFailLevel (10) and cliBackground (DOSTRUE).           *)
  1032.        (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  1033.  
  1034.   adoDirLen     * = adoDummy + 2; (* size in bytes for current dir buffer    *)
  1035.   adoCommNameLen* = adoDummy + 3; (* size in bytes for command name buffer   *)
  1036.   adoCommFileLen* = adoDummy + 4; (* size in bytes for command file buffer   *)
  1037.   adoPromptLen  * = adoDummy + 5; (* size in bytes for the prompt buffer     *)
  1038.  
  1039. (*****************************************************************************)
  1040. (* tags for NewLoadSeg *)
  1041. (* no tags are defined yet for NewLoadSeg *)
  1042.  
  1043.  
  1044. (*
  1045. **      $VER: exall.h 36.6 (5.4.92)
  1046. **
  1047. **      include file for ExAll() data structures
  1048. *)
  1049.  
  1050. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  1051. (* will return an error if passed edOwner.  If you get errorBadNumber,    *)
  1052. (* retry with edComment to get everything but owner info.  All filesystems  *)
  1053. (* supporting ExAll() must support through edComment, and must check Type   *)
  1054. (* and return errorBadNumber if they don't support the type.               *)
  1055.  
  1056. CONST
  1057.  
  1058. (* values that can be passed for what data you want from ExAll() *)
  1059. (* each higher value includes those below it (numerically)       *)
  1060. (* you MUST chose one of these values *)
  1061.   edName        * = 1;
  1062.   edType        * = 2;
  1063.   edSize        * = 3;
  1064.   edProtection  * = 4;
  1065.   edDate        * = 5;
  1066.   edComment     * = 6;
  1067.   edOwner       * = 7;
  1068.  
  1069. TYPE
  1070.  
  1071. (*
  1072.  *   Structure in which exall results are returned in.  Note that only the
  1073.  *   fields asked for will exist!
  1074.  *)
  1075.  
  1076.   ExAllData* = RECORD
  1077.     next     * : ExAllDataPtr;
  1078.     name     * : E.STRPTR;
  1079.     type     * : LONGINT;
  1080.     size     * : E.ULONG;
  1081.     prot     * : SET;
  1082.     days     * : E.ULONG;
  1083.     mins     * : E.ULONG;
  1084.     ticks    * : E.ULONG;
  1085.     comment  * : E.STRPTR;     (* strings will be after last used field *)
  1086.     ownerUID * : E.UWORD;      (* new for V39 *)
  1087.     ownerGID * : E.UWORD;
  1088.   END; (* ExAllData *)
  1089.  
  1090. (*
  1091.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1092.  *   0, expecially eacLastKey.
  1093.  *
  1094.  *   eacMatchFunc is a hook (see utility.library documentation for usage)
  1095.  *   It should return true if the entry is to returned, false if it is to be
  1096.  *   ignored.
  1097.  *
  1098.  *   This structure MUST be allocated by AllocDosObject()!
  1099.  *)
  1100.  
  1101.   ExAllControl* = RECORD
  1102.     entries    * : E.ULONG;   (* number of entries returned in buffer      *)
  1103.     lastKey    * : E.ULONG;   (* Don't touch inbetween linked ExAll calls! *)
  1104.     matchString* : E.STRPTR;  (* wildcard string for pattern match or NULL *)
  1105.     matchFunc  * : U.HookPtr; (* optional private wildcard function     *)
  1106.   END; (* ExAllControl *)
  1107.  
  1108. (*
  1109. **      $VER: dosextens.h 36.41 (14.5.92)
  1110. **
  1111. **      DOS structures not needed for the casual AmigaDOS user
  1112. *)
  1113.  
  1114. TYPE
  1115.  
  1116. (* All DOS processes have this structure *)
  1117. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  1118. (* devproc* = (DeviceProc(..) - SIZE (Task)); *)
  1119.  
  1120.   Process* = RECORD (E.Task)
  1121.     msgPort       * : E.MsgPort;     (* This is BPTR address from DOS functions  *)
  1122.     pad           * : INTEGER;       (* Remaining variables on 4 byte boundaries *)
  1123.     segList       * : BPTR;          (* Array of seg lists used by this process  *)
  1124.     stackSize     * : LONGINT;       (* Size of process stack in bytes           *)
  1125.     globVec       * : E.APTR;        (* Global vector for this process (BCPL)    *)
  1126.     taskNum       * : LONGINT;       (* CLI task number of zero if not a CLI     *)
  1127.     stackBase     * : BPTR;          (* Ptr to high memory end of process stack  *)
  1128.     result2       * : LONGINT;       (* Value of secondary result from last call *)
  1129.     currentDir    * : FileLockPtr;   (* Lock associated with current directory   *)
  1130.     cis           * : FileHandlePtr; (* Current CLI Input Stream                 *)
  1131.     cos           * : FileHandlePtr; (* Current CLI Output Stream                *)
  1132.     consoleTask   * : ProcessId;     (* Console handler process for current window*)
  1133.     fileSystemTask* : ProcessId;     (* File handler process for current drive   *)
  1134.     cli           * : CommandLineInterfacePtr;
  1135.                                      (* pointer to CommandLineInterface          *)
  1136.     returnAddr    * : E.APTR;        (* pointer to previous stack frame          *)
  1137.     pktWait       * : E.APTR;        (* Function to be called when awaiting msg  *)
  1138.     windowPtr     * : E.APTR;        (* Window for error printing                *)
  1139.  
  1140.     (* following definitions are new with 2.0 *)
  1141.     homeDir       * : FileLockPtr;   (* Home directory of executing program      *)
  1142.     prFlags       * : SET;           (* flags telling dos about process          *)
  1143.     exitCode      * : E.PROC;        (* code to call on exit of program or NULL  *)
  1144.     exitData      * : LONGINT;       (* Passed as an argument to prExitCode.     *)
  1145.     arguments     * : E.STRPTR;      (* Arguments passed to the process at start *)
  1146.     localVars     * : E.MinList;     (* Local environment variables              *)
  1147.     shellPrivate  * : E.ULONG;       (* for the use of the current shell         *)
  1148.     ces           * : FileHandlePtr; (* Error stream - if NULL, use prCOS        *)
  1149.   END; (* Process *)
  1150.  
  1151. CONST
  1152.  
  1153. (*
  1154.  * Flags for Process.prFlags
  1155.  *)
  1156.   prFreeSegList        * = 0;
  1157.   prFreeCurrDir        * = 1;
  1158.   prFreeCli            * = 2;
  1159.   prCloseInput         * = 3;
  1160.   prCloseOutput        * = 4;
  1161.   prFreeArgs           * = 5;
  1162.  
  1163. TYPE
  1164.  
  1165. (* The long word address (BPTR) of this structure is returned by
  1166.  * Open() and other routines that return a file.  You need only worry
  1167.  * about this struct to do async io's via PutMsg() instead of
  1168.  * standard file system calls *)
  1169.  
  1170.   FileHandle* = RECORD
  1171.     link  * : E.MessagePtr; (* EXEC message              *)
  1172.     port  * : E.MsgPortPtr; (* Reply port for the packet *)
  1173.     type  * : ProcessId;    (* Port to do PutMsg() to
  1174.                              * Address is negative if a plain file *)
  1175.     buf   * : LONGINT;
  1176.     pos   * : LONGINT;
  1177.     end   * : LONGINT;
  1178.     func1 * : LONGINT;
  1179.     func2 * : LONGINT;
  1180.     func3 * : LONGINT;
  1181.     arg1  * : LONGINT;
  1182.     arg2  * : LONGINT;
  1183.   END; (* FileHandle *)
  1184.  
  1185. (* This is the extension to EXEC Messages used by DOS *)
  1186.  
  1187.   DosPacket* = RECORD
  1188.     link* : E.MessagePtr;     (* EXEC message              *)
  1189.     port* : E.MsgPortPtr;     (* Reply port for the packet *)
  1190.                               (* Must be filled in each send. *)
  1191.     type* : LONGINT;          (* See action... below and
  1192.                                * 'R' means Read, 'W' means Write to the
  1193.                                * file system *)
  1194.     res1* : LONGINT;          (* For file system calls this is the result
  1195.                                * that would have been returned by the
  1196.                                * function, e.g. Write ('W') returns actual
  1197.                                * length written *)
  1198.     res2* : LONGINT;          (* For file system calls this is what would
  1199.                                * have been returned by IoErr() *)
  1200.     arg1* : LONGINT;
  1201.     arg2* : LONGINT;
  1202.     arg3* : LONGINT;
  1203.     arg4* : LONGINT;
  1204.     arg5* : LONGINT;
  1205.     arg6* : LONGINT;
  1206.     arg7* : LONGINT;
  1207.   END; (* DosPacket *)
  1208.  
  1209. (* A Packet does not require the Message to be before it in memory, but
  1210.  * for convenience it is useful to associate the two.
  1211.  * Also see the function initstdpkt for initializing this structure *)
  1212.  
  1213.   StandardPacket* = RECORD (E.Message)
  1214.     pkt * : DosPacket;
  1215.   END; (* StandardPacket *)
  1216.  
  1217. CONST
  1218.  
  1219. (* DosPacket types *)
  1220.   actionNil             * = 0;
  1221.   actionStartup         * = 0;
  1222.   actionGetBlock        * = 2;       (* OBSOLETE *)
  1223.   actionSetMap          * = 4;
  1224.   actionDie             * = 5;
  1225.   actionEvent           * = 6;
  1226.   actionCurrentVolume   * = 7;
  1227.   actionLocateObject    * = 8;
  1228.   actionRenameDisk      * = 9;
  1229.   actionWrite           * = ORD ("W");
  1230.   actionRead            * = ORD ("R");
  1231.   actionFreeLock        * = 15;
  1232.   actionDeleteObject    * = 16;
  1233.   actionRenameObject    * = 17;
  1234.   actionMoreCache       * = 18;
  1235.   actionCopyDir         * = 19;
  1236.   actionWaitChar        * = 20;
  1237.   actionSetProtect      * = 21;
  1238.   actionCreateDir       * = 22;
  1239.   actionExamineObject   * = 23;
  1240.   actionExamineNext     * = 24;
  1241.   actionDiskInfo        * = 25;
  1242.   actionInfo            * = 26;
  1243.   actionFlush           * = 27;
  1244.   actionSetComment      * = 28;
  1245.   actionParent          * = 29;
  1246.   actionTimer           * = 30;
  1247.   actionInhibit         * = 31;
  1248.   actionDiskType        * = 32;
  1249.   actionDiskChange      * = 33;
  1250.   actionSetDate         * = 34;
  1251.  
  1252.   actionScreenMode      * = 994;
  1253.  
  1254.   actionReadReturn      * = 1001;
  1255.   actionWriteReturn     * = 1002;
  1256.   actionSeek            * = 1008;
  1257.   actionFindUpdate      * = 1004;
  1258.   actionFindInput       * = 1005;
  1259.   actionFindOutput      * = 1006;
  1260.   actionEnd             * = 1007;
  1261.   actionSetFileSize     * = 1022;    (* fast file system only in 1.3 *)
  1262.   actionWriteprotect    * = 1023;    (* fast file system only in 1.3 *)
  1263.  
  1264. (* new 2.0 packets *)
  1265.   actionSameLock       * = 40;
  1266.   actionChangeSignal   * = 995;
  1267.   actionFormat         * = 1020;
  1268.   actionMakeLink       * = 1021;
  1269.  
  1270.   actionReadLink       * = 1024;
  1271.   actionFhFromLock     * = 1026;
  1272.   actionIsFileSystem   * = 1027;
  1273.   actionChangeMode     * = 1028;
  1274.  
  1275.   actionCopyDirFH      * = 1030;
  1276.   actionParentFH       * = 1031;
  1277.   actionExamineAll     * = 1033;
  1278.   actionExamineFH      * = 1034;
  1279.  
  1280.   actionLockRecord     * = 2008;
  1281.   actionFreeRecord     * = 2009;
  1282.  
  1283.   actionAddNotify      * = 4097;
  1284.   actionRemoveNotify   * = 4098;
  1285.  
  1286. (* Added in V39: *)
  1287.   actionExamineAllEnd  * = 1035;
  1288.   actionSetOwner       * = 1036;
  1289.  
  1290. (* Tell a file system to serialize the current volume. This is typically
  1291.  * done by changing the creation date of the disk. This packet does not take
  1292.  * any arguments.  NOTE: be prepared to handle failure of this packet for
  1293.  * V37 ROM filesystems.
  1294.  *)
  1295.   actionSerializeDisk  * = 4200;
  1296.  
  1297. TYPE
  1298.  
  1299. (*
  1300.  * A structure for holding error messages - stored as array with error = 0
  1301.  * for the last entry.
  1302.  *)
  1303.   ErrorString* = RECORD
  1304.     nums   * : E.APTR;
  1305.     strings* : E.APTR;
  1306.   END; (* ErrorString *)
  1307.  
  1308. (* DOS library node structure.
  1309.  * This is the data at positive offsets from the library node.
  1310.  * Negative offsets from the node is the jump table to DOS functions
  1311.  * node = OpenLibrary( "dos.library" .. )      *)
  1312.  
  1313.   DosLibrary* = RECORD (E.Library)
  1314.     root        * : RootNodePtr;      (* Pointer to RootNode, described below *)
  1315.     gv          * : E.APTR;           (* Pointer to BCPL global vector        *)
  1316.     a2          * : LONGINT;          (* BCPL standard register values        *)
  1317.     a5          * : LONGINT;
  1318.     a6          * : LONGINT;
  1319.     errors        : ErrorStringPtr;   (* PRIVATE pointer to array of error msgs *)
  1320.     timeReq       : T.TimeRequestPtr; (* PRIVATE pointer to timer request *)
  1321.     utilityBase   : E.LibraryPtr;     (* PRIVATE ptr to utility library *)
  1322.     intuitionBase : E.LibraryPtr      (* PRIVATE ptr to intuition library *)
  1323.   END; (* DosLibrary *)
  1324.  
  1325.   TaskArray* = RECORD
  1326.     maxCLI * : LONGINT;
  1327.     cli    * : ARRAY 32767 OF ProcessId;
  1328.   END; (* TaskArray *)
  1329.  
  1330.   RootNode* = RECORD
  1331.     taskArray     * : TaskArrayPtr; (* [0] is max number of CLI's
  1332.                                      * [1] is APTR to process id of CLI 1
  1333.                                      * [n] is APTR to process id of CLI n *)
  1334.     consoleSegment* : BPTR;         (* SegList for the CLI                      *)
  1335.     time          * : Date;         (* Current time                        *)
  1336.     restartSeg    * : BPTR;         (* SegList for the disk validator process   *)
  1337.     info          * : DosInfoPtr;   (* Pointer to the Info structure            *)
  1338.     fileHandlerSegment* : BPTR;     (* segment for a file handler               *)
  1339.     cliList       * : E.MinList;    (* new list of all CLI processes *)
  1340.                                     (* the first cplArray is also rnTaskArray   *)
  1341.     bootProc      * : ProcessId;    (* private ptr to msgport of boot fs        *)
  1342.     shellSegment  * : BPTR;         (* seglist for Shell (for NewShell)         *)
  1343.     flags         * : SET;          (* dos flags *)
  1344.   END; (* RootNode *)
  1345.  
  1346. CONST
  1347.  
  1348.   rnWildStar   * = 24;
  1349.   rnPrivate1     = 1;       (* private for dos *)
  1350.  
  1351. TYPE
  1352.  
  1353. (* ONLY to be allocated by DOS! *)
  1354.   CliProcList* = RECORD (E.MinNode)
  1355.     first* : LONGINT;    (* number of first entry in array *)
  1356.     array* : CPOINTER TO ARRAY 32767 OF ProcessId;
  1357.                          (* [0] is max number of CLI's in this entry (n)
  1358.                           * [1] is CPTR to process id of CLI cplFirst
  1359.                           * [n] is CPTR to process id of CLI cplFirst+n-1
  1360.                           *)
  1361.   END; (* CliProcList *)
  1362.  
  1363.   DosInfo* = RECORD
  1364.     mcName      : BPTR;       (* PRIVATE: system resident module list      *)
  1365.     devInfo   * : DevInfoPtr; (* Device List                               *)
  1366.     devices   * : BPTR;       (* Currently zero                            *)
  1367.     handlers  * : BPTR;       (* Currently zero                            *)
  1368.     netHand   * : ProcessId;  (* Network handler processid; currently zero *)
  1369.     devLock     : E.SignalSemaphore; (* do NOT access directly! *)
  1370.     entryLock   : E.SignalSemaphore; (* do NOT access directly! *)
  1371.     deleteLock  : E.SignalSemaphore; (* do NOT access directly! *)
  1372.   END; (* DosInfo *)  (* DosInfo *)
  1373.  
  1374. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  1375. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  1376.  
  1377.   Segment* = RECORD
  1378.     next* : BPTR;
  1379.     uc  * : LONGINT;
  1380.     seg * : BPTR;
  1381.     name* : ARRAY 4 OF CHAR; (* actually the first 4 chars of BSTR name *)
  1382.   END; (* Segment *)
  1383.  
  1384. CONST
  1385.  
  1386.   cmdSystem     * = -1;
  1387.   cmdInternal   * = -2;
  1388.   cmdDisabled   * = -999;
  1389.  
  1390. TYPE
  1391.  
  1392.   PathLockPtr * = CPOINTER TO PathLock;
  1393.   PathLock * = RECORD
  1394.     next * : PathLockPtr;
  1395.     lock * : FileLockPtr;
  1396.   END; (* PathLock *)
  1397.  
  1398.  
  1399. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  1400.  * set to data associated with them *)
  1401.  
  1402.   CommandLineInterface* = RECORD
  1403.     result2       * : LONGINT;       (* Value of IoErr from last command        *)
  1404.     setName       * : BSTR;          (* Name of current directory               *)
  1405.     commandDir    * : PathLockPtr;   (* Head of the path locklist               *)
  1406.     returnCode    * : LONGINT;       (* Return code from last command           *)
  1407.     commandName   * : BSTR;          (* Name of current command                 *)
  1408.     failLevel     * : LONGINT;       (* Fail level (set by FAILAT)              *)
  1409.     prompt        * : BSTR;          (* Current prompt (set by PROMPT)          *)
  1410.     standardInput * : FileHandlePtr; (* Default (terminal) CLI input            *)
  1411.     currentInput  * : FileHandlePtr; (* Current CLI input                       *)
  1412.     commandFile   * : BSTR;          (* Name of EXECUTE command file            *)
  1413.     interactive   * : LONGINT;       (* Boolean; True if prompts required       *)
  1414.     background    * : LONGINT;       (* Boolean; True if CLI created by RUN     *)
  1415.     currentOutput * : FileHandlePtr; (* Current CLI output                      *)
  1416.     defaultStack  * : LONGINT;       (* Stack size to be obtained in long words *)
  1417.     standardOutput* : FileHandlePtr; (* Default (terminal) CLI output           *)
  1418.     module        * : BPTR;          (* SegList of currently loaded command     *)
  1419.   END; (* CommandLineInterface *)
  1420.   CommandLineInterfaceAPtr* = CPOINTER TO CommandLineInterface;
  1421.  
  1422. (* This structure can take on different values depending on whether it is
  1423.  * a device, an assigned directory, or a volume.  Below is the structure
  1424.  * reflecting volumes only.  Following that is the structure representing
  1425.  * only devices. Following that is the unioned structure representing all
  1426.  * the values
  1427.  *)
  1428.  
  1429.   DosListNode * = RECORD END;
  1430.  
  1431. (* structure representing a volume *)
  1432.  
  1433.   DeviceList* = RECORD (DosListNode)
  1434.     next      * : DeviceListPtr; (* bptr to next device list *)
  1435.     type      * : LONGINT;       (* see DLT below *)
  1436.     task      * : ProcessId;     (* ptr to handler task *)
  1437.     lock      * : FileLockPtr;   (* not for volumes *)
  1438.     volumeDate* : Date;          (* creation date *)
  1439.     lockList  * : FileLockPtr;   (* outstanding locks *)
  1440.     diskType  * : LONGINT;       (* 'DOS', etc *)
  1441.     unused    * : LONGINT;
  1442.     name      * : BSTR;          (* bptr to bcpl name *)
  1443.   END; (* DeviceList *)
  1444.   DeviceListAPtr*           = CPOINTER TO DeviceList;
  1445.  
  1446. (* device structure (same as the DeviceNode structure in filehandler.h) *)
  1447.  
  1448.   DevInfo* = RECORD (DosListNode)
  1449.     next     * : DevInfoPtr;
  1450.     type     * : LONGINT;
  1451.     task     * : ProcessId;
  1452.     lock     * : FileLockPtr;
  1453.     handler  * : BSTR;
  1454.     stackSize* : LONGINT;
  1455.     priority * : LONGINT;
  1456.     startup  * : FileSysStartupMsgPtr;
  1457.     segList  * : BPTR;
  1458.     globVec  * : BPTR;
  1459.     name     * : BSTR;
  1460.   END; (* DevInfo *)
  1461.   DevInfoAPtr*              = CPOINTER TO DevInfo;
  1462.  
  1463. (* structure used for multi-directory assigns. AllocVec()ed. *)
  1464.  
  1465.   AssignList* = RECORD
  1466.     next* : AssignListPtr;
  1467.     lock* : FileLockPtr;
  1468.   END; (* AssignList *)
  1469.  
  1470. (* combined structure for devices, assigned directories, volumes *)
  1471.  
  1472.   DosList* = RECORD (DosListNode)
  1473.     next      * : DevInfoPtr;      (* bptr to next device on list *)
  1474.     type      * : LONGINT;         (* see DLT below *)
  1475.     task      * : ProcessId;       (* ptr to handler task *)
  1476.     lock      * : FileLockPtr;
  1477.     assignName* : E.STRPTR;        (* name for non-or-late-binding assign *)
  1478.     list      * : AssignListPtr;   (* for multi-directory assigns (regular) *)
  1479.     unused    * : ARRAY 4 OF LONGINT;
  1480.  
  1481.     name      * : BSTR;            (* bptr to bcpl name *)
  1482.   END; (* DosList *)
  1483.   DosListAPtr*              = CPOINTER TO DosList;
  1484.  
  1485. CONST
  1486.  
  1487. (* definitions for DosList.type *)
  1488.   dltDevice     * = 0;
  1489.   dltDirectory  * = 1;       (* assign *)
  1490.   dltVolume     * = 2;
  1491.   dltLate       * = 3;       (* late-binding assign *)
  1492.   dltNonBinding * = 4;       (* non-binding assign *)
  1493.   dltPrivate    * = -1;      (* for internal use only *)
  1494.  
  1495. TYPE
  1496.  
  1497. (* structure return by GetDeviceProc() *)
  1498.   DevProc* = RECORD
  1499.     port   * : E.MsgPortPtr;
  1500.     lock   * : FileLockPtr;
  1501.     flags  * : SET;
  1502.     devNode  : DosListNodePtr;    (* DON'T TOUCH OR USE! *)
  1503.   END; (* DevProc *)
  1504.  
  1505. CONST
  1506.  
  1507. (* definitions for DevProc.flags *)
  1508.   dvpUnLock    * = 0;
  1509.   dvpAssign    * = 1;
  1510.  
  1511. (* Flags to be passed to LockDosList(), etc *)
  1512.   ldDevices    * = 2;
  1513.   ldVolumes    * = 3;
  1514.   ldAssigns    * = 4;
  1515.   ldEntry      * = 5;
  1516.   ldDelete     * = 6;
  1517.  
  1518. (* you MUST specify one of ldRead or ldWrite *)
  1519.   ldRead       * = 0;
  1520.   ldWrite      * = 1;
  1521.  
  1522. (* actually all but ldEntry (which is used for internal locking) *)
  1523.   all        * = {ldDevices, ldVolumes, ldAssigns};
  1524.  
  1525. TYPE
  1526.  
  1527. (* a lock structure, as returned by Lock() or DupLock() *)
  1528.   FileLock* = RECORD
  1529.     link  - : FileLockPtr;     (* bcpl pointer to next lock *)
  1530.     key   * : LONGINT;         (* disk block number *)
  1531.     access* : LONGINT;         (* exclusive or shared *)
  1532.     task  * : ProcessId;       (* handler task's port *)
  1533.     volume* : DeviceListPtr;   (* bptr to dltVOLUME DosList entry *)
  1534.   END; (* FileLock *)
  1535.  
  1536. CONST
  1537.  
  1538. (* error report types for ErrorReport() *)
  1539.   reportStream          * = 0;       (* a stream *)
  1540.   reportTask            * = 1;       (* a process - unused *)
  1541.   reportLock            * = 2;       (* a lock *)
  1542.   reportVolume          * = 3;       (* a volume node *)
  1543.   reportInsert          * = 4;       (* please insert volume *)
  1544.  
  1545. (* Special error codes for ErrorReport() *)
  1546.   abortDiskError        * = 296;     (* Read/write error *)
  1547.   abortBusy             * = 288;     (* You MUST replace... *)
  1548.  
  1549. (* types for initial packets to shells from run/newcli/execute/system. *)
  1550. (* For shell-writers only *)
  1551.   runExecute            * = -1;
  1552.   runSystem             * = -2;
  1553.   runSystemAsynch       * = -3;
  1554.  
  1555. (* Types for fibDirEntryType.  NOTE that both USERDIR and ROOT are      *)
  1556. (* directories, and that directory/file checks should use <0 and >=0.    *)
  1557. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  1558. (* values as needed, though <0 and >=0 should remain as supported as     *)
  1559. (* possible.                                                             *)
  1560.   stRoot        * = 1;
  1561.   stUserDir     * = 2;
  1562.   stSoftLink    * = 3;       (* looks like dir, but may point to a file! *)
  1563.   stLinkDir     * = 4;       (* hard link to dir *)
  1564.   stFile        * = -3;      (* must be negative for FIB! *)
  1565.   stLinkFile    * = -4;      (* hard link to file *)
  1566.   stPipeFile    * = -5;      (* for pipes that support ExamineFH *)
  1567.  
  1568. (*
  1569. **      $VER: stdio.h 36.6 (1.11.91)
  1570. **
  1571. **      ANSI-like stdio defines for dos buffered I/O
  1572. *)
  1573.  
  1574. CONST
  1575.  
  1576. (* types for SetVBuf *)
  1577.   bufLine * = 0;                (* flush on \n, etc *)
  1578.   bufFull * = 1;                (* never flush except when needed *)
  1579.   bufNone * = 2;                (* no buffering *)
  1580.  
  1581. (* EOF return value *)
  1582.   endStreamCh * = -1;
  1583.  
  1584.  
  1585. (**-- Library Base variable --------------------------------------------*)
  1586.  
  1587. VAR
  1588.  
  1589.   base* : DosLibraryPtr;
  1590.  
  1591.  
  1592. (**-- Library Functions ------------------------------------------------*)
  1593.  
  1594. (*
  1595. **      $VER: dos_protos.h 36.31 (17.12.92)
  1596. *)
  1597.  
  1598. LIBCALL (base : DosLibraryPtr) Open*
  1599.   ( name       [1] : ARRAY OF CHAR;
  1600.     accessMode [2] : LONGINT)
  1601.   : FileHandlePtr;
  1602.   -30;
  1603. LIBCALL (base : DosLibraryPtr) Close*
  1604.   ( file [1] : FileHandlePtr )
  1605.   : BOOLEAN;
  1606.   -36;
  1607. LIBCALL (base : DosLibraryPtr) OldClose*
  1608.   ( file [1] : FileHandlePtr );
  1609.   -36;
  1610. LIBCALL (base : DosLibraryPtr) Read*
  1611.   ( file       [1] : FileHandlePtr;
  1612.     VAR buffer [2] : ARRAY OF SYS.BYTE;
  1613.     length     [3] : LONGINT)
  1614.   : LONGINT;
  1615.   -42;
  1616. LIBCALL (base : DosLibraryPtr) Write*
  1617.   ( file   [1] : FileHandlePtr;
  1618.     buffer [2] : ARRAY OF SYS.BYTE;
  1619.     length [3] : LONGINT)
  1620.   : LONGINT;
  1621.   -48;
  1622. LIBCALL (base : DosLibraryPtr) Input* ()
  1623.   : FileHandlePtr;
  1624.   -54;
  1625. LIBCALL (base : DosLibraryPtr) Output* ()
  1626.   : FileHandlePtr;
  1627.   -60;
  1628. LIBCALL (base : DosLibraryPtr) Seek*
  1629.   ( file     [1] : FileHandlePtr;
  1630.     position [2] : LONGINT;
  1631.     offset   [3] : LONGINT)
  1632.   : LONGINT;
  1633.   -66;
  1634. LIBCALL (base : DosLibraryPtr) DeleteFile*
  1635.   ( name [1] : ARRAY OF CHAR )
  1636.   : BOOLEAN;
  1637.   -72;
  1638. LIBCALL (base : DosLibraryPtr) Rename*
  1639.   ( oldName [1] : ARRAY OF CHAR;
  1640.     newName [2] : ARRAY OF CHAR )
  1641.   : BOOLEAN;
  1642.   -78;
  1643. LIBCALL (base : DosLibraryPtr) Lock*
  1644.   ( name [1] : ARRAY OF CHAR;
  1645.     type [2] : LONGINT)
  1646.   : FileLockPtr;
  1647.   -84;
  1648. LIBCALL (base : DosLibraryPtr) UnLock*
  1649.   ( lock [1] : FileLockPtr );
  1650.   -90;
  1651. LIBCALL (base : DosLibraryPtr) DupLock*
  1652.   ( lock [1] : FileLockPtr )
  1653.   : FileLockPtr;
  1654.   -96;
  1655. LIBCALL (base : DosLibraryPtr) Examine*
  1656.   ( lock    [1] : FileLockPtr;
  1657.     VAR fib [2] : FileInfoBlock )
  1658.   : BOOLEAN;
  1659.   -102;
  1660. LIBCALL (base : DosLibraryPtr) ExNext*
  1661.   ( lock    [1] : FileLockPtr;
  1662.     VAR fib [2] : FileInfoBlock )
  1663.   : BOOLEAN;
  1664.   -108;
  1665. LIBCALL (base : DosLibraryPtr) Info*
  1666.   ( lock     [1] : FileLockPtr;
  1667.     VAR info [2] : InfoData )
  1668.   : BOOLEAN;
  1669.   -114;
  1670. LIBCALL (base : DosLibraryPtr) CreateDir*
  1671.   ( name [1] : ARRAY OF CHAR )
  1672.   : FileLockPtr;
  1673.   -120;
  1674. LIBCALL (base : DosLibraryPtr) CurrentDir*
  1675.   ( lock [1] : FileLockPtr )
  1676.   : FileLockPtr;
  1677.   -126;
  1678. LIBCALL (base : DosLibraryPtr) IoErr* ()
  1679.   : LONGINT;
  1680.   -132;
  1681. LIBCALL (base : DosLibraryPtr) CreateProc*
  1682.   ( name      [1] : ARRAY OF CHAR;
  1683.     pri       [2] : LONGINT;
  1684.     segList   [3] : BPTR;
  1685.     stackSize [4] : LONGINT)
  1686.   : ProcessId;
  1687.   -138;
  1688. LIBCALL (base : DosLibraryPtr) Exit*
  1689.   ( returnCode [1] : LONGINT);
  1690.   -144;
  1691. LIBCALL (base : DosLibraryPtr) LoadSeg*
  1692.   ( name [1] : ARRAY OF CHAR )
  1693.   : BPTR;
  1694.   -150;
  1695. LIBCALL (base : DosLibraryPtr) UnLoadSeg*
  1696.   ( seglist [1] : BPTR );
  1697.   -156;
  1698. LIBCALL (base : DosLibraryPtr) DeviceProc*
  1699.   ( name [1] : ARRAY OF CHAR )
  1700.   : ProcessId;
  1701.   -174;
  1702. LIBCALL (base : DosLibraryPtr) SetComment*
  1703.   ( name    [1] : ARRAY OF CHAR;
  1704.     comment [2] : ARRAY OF CHAR )
  1705.   : BOOLEAN;
  1706.   -180;
  1707. LIBCALL (base : DosLibraryPtr) SetProtection*
  1708.   ( name    [1] : ARRAY OF CHAR;
  1709.     protect [2] : SET)
  1710.   : BOOLEAN;
  1711.   -186;
  1712. LIBCALL (base : DosLibraryPtr) DateStamp*
  1713.   ( VAR date [1] : Date );
  1714.   -192;
  1715. LIBCALL (base : DosLibraryPtr) Delay*
  1716.   ( timeout [1] : E.ULONG);
  1717.   -198;
  1718. LIBCALL (base : DosLibraryPtr) WaitForChar*
  1719.   ( file    [1] : FileHandlePtr;
  1720.     timeout [2] : LONGINT)
  1721.   : BOOLEAN;
  1722.   -204;
  1723. LIBCALL (base : DosLibraryPtr) ParentDir*
  1724.   ( lock [1] : FileLockPtr )
  1725.   : FileLockPtr;
  1726.   -210;
  1727. LIBCALL (base : DosLibraryPtr) IsInteractive*
  1728.   ( file [1] : FileHandlePtr )
  1729.   : BOOLEAN;
  1730.   -216;
  1731. LIBCALL (base : DosLibraryPtr) Execute*
  1732.   ( string [1] : ARRAY OF CHAR;
  1733.     file   [2] : FileHandlePtr;
  1734.     file2  [3] : FileHandlePtr )
  1735.   : BOOLEAN;
  1736.   -222;
  1737.  
  1738. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  1739.  
  1740. (*      DOS Object creation/deletion *)
  1741.  
  1742. LIBCALL (base : DosLibraryPtr) AllocDosObject*
  1743.   ( type [1] : E.ULONG;
  1744.     tags [2] : ARRAY OF U.TagItem )
  1745.   : E.APTR;
  1746.   -228;
  1747. LIBCALL (base : DosLibraryPtr) AllocDosObjectTags*
  1748.   ( type [1]   : E.ULONG;
  1749.     tags [2].. : U.Tag )
  1750.   : E.APTR;
  1751.   -228;
  1752. LIBCALL (base : DosLibraryPtr) FreeDosObject*
  1753.   ( type [1] : E.ULONG;
  1754.     ptr  [2] : E.APTR );
  1755.   -234;
  1756.  
  1757. (*      Packet Level routines *)
  1758.  
  1759. LIBCALL (base : DosLibraryPtr) DoPkt*
  1760.   ( port   [1] : ProcessId;
  1761.     action [2] : LONGINT;
  1762.     arg1   [3] : LONGINT;
  1763.     arg2   [4] : LONGINT;
  1764.     arg3   [5] : LONGINT;
  1765.     arg4   [6] : LONGINT;
  1766.     arg5   [7] : LONGINT)
  1767.   : LONGINT;
  1768.   -240;
  1769. LIBCALL (base : DosLibraryPtr) DoPkt0*
  1770.   ( port   [1] : ProcessId;
  1771.     action [2] : LONGINT)
  1772.   : LONGINT;
  1773.   -240;
  1774. LIBCALL (base : DosLibraryPtr) DoPkt1*
  1775.   ( port   [1] : ProcessId;
  1776.     action [2] : LONGINT;
  1777.     arg1   [3] : LONGINT)
  1778.   : LONGINT;
  1779.   -240;
  1780. LIBCALL (base : DosLibraryPtr) DoPkt2*
  1781.   ( port   [1] : ProcessId;
  1782.     action [2] : LONGINT;
  1783.     arg1   [3] : LONGINT;
  1784.     arg2   [4] : LONGINT)
  1785.   : LONGINT;
  1786.   -240;
  1787. LIBCALL (base : DosLibraryPtr) DoPkt3*
  1788.   ( port   [1] : ProcessId;
  1789.     action [2] : LONGINT;
  1790.     arg1   [3] : LONGINT;
  1791.     arg2   [4] : LONGINT;
  1792.     arg3   [5] : LONGINT)
  1793.   : LONGINT;
  1794.   -240;
  1795. LIBCALL (base : DosLibraryPtr) DoPkt4*
  1796.   ( port   [1] : ProcessId;
  1797.     action [2] : LONGINT;
  1798.     arg1   [3] : LONGINT;
  1799.     arg2   [4] : LONGINT;
  1800.     arg3   [5] : LONGINT;
  1801.     arg4   [6] : LONGINT)
  1802.   : LONGINT;
  1803.   -240;
  1804. LIBCALL (base : DosLibraryPtr) SendPkt*
  1805.   ( VAR dp    [1] : DosPacket;
  1806.     port      [2] : ProcessId;
  1807.     replyport [3] : E.MsgPortPtr );
  1808.   -246;
  1809. LIBCALL (base : DosLibraryPtr) WaitPkt* ()
  1810.   : DosPacketPtr;
  1811.   -252;
  1812. LIBCALL (base : DosLibraryPtr) ReplyPkt*
  1813.   ( dp   [1] : DosPacketPtr;
  1814.     res1 [2] : LONGINT;
  1815.     res2 [3] : LONGINT);
  1816.   -258;
  1817. LIBCALL (base : DosLibraryPtr) AbortPkt*
  1818.   ( port [1] : ProcessId;
  1819.     pkt  [2] : DosPacketPtr );
  1820.   -264;
  1821.  
  1822. (*      Record Locking *)
  1823.  
  1824. LIBCALL (base : DosLibraryPtr) LockRecord*
  1825.   ( fh      [1] : FileHandlePtr;
  1826.     offset  [2] : E.ULONG;
  1827.     length  [3] : E.ULONG;
  1828.     mode    [4] : E.ULONG;
  1829.     timeout [5] : E.ULONG )
  1830.   : BOOLEAN;
  1831.   -270;
  1832. LIBCALL (base : DosLibraryPtr) LockRecords*
  1833.   ( recArray [1] : RecordLockPtr;
  1834.     timeout  [2] : E.ULONG )
  1835.   : BOOLEAN;
  1836.   -276;
  1837. LIBCALL (base : DosLibraryPtr) UnLockRecord*
  1838.   ( fh     [1] : FileHandlePtr;
  1839.     offset [2] : E.ULONG;
  1840.     length [3] : E.ULONG )
  1841.   : BOOLEAN;
  1842.   -282;
  1843. LIBCALL (base : DosLibraryPtr) UnLockRecords*
  1844.   ( recArray [1] : RecordLockPtr )
  1845.   : BOOLEAN;
  1846.   -288;
  1847.  
  1848. (*      Buffered File I/O *)
  1849.  
  1850. LIBCALL (base : DosLibraryPtr) SelectInput*
  1851.   ( fh [1] : FileHandlePtr )
  1852.   : FileHandlePtr;
  1853.   -294;
  1854. LIBCALL (base : DosLibraryPtr) SelectOutput*
  1855.   ( fh [1] : FileHandlePtr )
  1856.   : FileHandlePtr;
  1857.   -300;
  1858. LIBCALL (base : DosLibraryPtr) FGetC*
  1859.   ( fh [1] : FileHandlePtr )
  1860.   : LONGINT;
  1861.   -306;
  1862. LIBCALL (base : DosLibraryPtr) FPutC*
  1863.   ( fh [1] : FileHandlePtr;
  1864.     ch [2] : LONGINT )
  1865.   : LONGINT;
  1866.   -312;
  1867. LIBCALL (base : DosLibraryPtr) UnGetC*
  1868.   ( fh        [1] : FileHandlePtr;
  1869.     character [2] : LONGINT)
  1870.   : LONGINT;
  1871.   -318;
  1872. LIBCALL (base : DosLibraryPtr) FRead*
  1873.   ( fh        [1] : FileHandlePtr;
  1874.     VAR block [2] : ARRAY OF SYS.BYTE;
  1875.     blocklen  [3] : E.ULONG;
  1876.     number    [4] : E.ULONG )
  1877.   : LONGINT;
  1878.   -324;
  1879. LIBCALL (base : DosLibraryPtr) FWrite*
  1880.   ( fh       [1] : FileHandlePtr;
  1881.     block    [2] : ARRAY OF SYS.BYTE;
  1882.     blocklen [3] : E.ULONG;
  1883.     number   [4] : E.ULONG )
  1884.   : LONGINT;
  1885.   -330;
  1886. LIBCALL (base : DosLibraryPtr) FGets*
  1887.   ( fh      [1] : FileHandlePtr;
  1888.     VAR buf [2] : ARRAY OF CHAR;
  1889.     buflen  [3] : E.ULONG )
  1890.   : E.APTR;
  1891.   -336;
  1892. LIBCALL (base : DosLibraryPtr) FPuts*
  1893.   ( fh  [1] : FileHandlePtr;
  1894.     str [2] : ARRAY OF CHAR )
  1895.   : BOOLEAN;
  1896.   -342;
  1897. LIBCALL (base : DosLibraryPtr) VFWritef*
  1898.   ( fh     [1] : FileHandlePtr;
  1899.     format [2] : ARRAY OF CHAR;
  1900.     argv   [3] : ARRAY OF SYS.LONGWORD )
  1901.   : LONGINT;
  1902.   -348;
  1903. LIBCALL (base : DosLibraryPtr) FWritef*
  1904.   ( fh     [1]   : FileHandlePtr;
  1905.     format [2]   : ARRAY OF CHAR;
  1906.     argv   [3].. : SYS.LONGWORD )
  1907.   : LONGINT;
  1908.   -348;
  1909. LIBCALL (base : DosLibraryPtr) VFPrintf*
  1910.   ( fh     [1] : FileHandlePtr;
  1911.     format [2] : ARRAY OF CHAR;
  1912.     argv   [3] : ARRAY OF SYS.LONGWORD )
  1913.   : LONGINT;
  1914.   -354;
  1915. LIBCALL (base : DosLibraryPtr) FPrintf*
  1916.   ( fh     [1]   : FileHandlePtr;
  1917.     format [2]   : ARRAY OF CHAR;
  1918.     argv   [3].. : SYS.LONGWORD )
  1919.   : LONGINT;
  1920.   -354;
  1921. LIBCALL (base : DosLibraryPtr) Flush*
  1922.   ( fh [1] : FileHandlePtr )
  1923.   : BOOLEAN;
  1924.   -360;
  1925. LIBCALL (base : DosLibraryPtr) SetVBuf*
  1926.   ( fh       [1] : FileHandlePtr;
  1927.     VAR buff [2] : ARRAY OF CHAR;
  1928.     type     [3] : LONGINT;
  1929.     size     [4] : LONGINT)
  1930.   : LONGINT;
  1931.   -366;
  1932. LIBCALL (base : DosLibraryPtr) SetVBufPtr*
  1933.   ( fh   [1] : FileHandlePtr;
  1934.     buff [2] : E.STRPTR;
  1935.     type [3] : LONGINT;
  1936.     size [4] : LONGINT)
  1937.   : LONGINT;
  1938.   -366;
  1939.  
  1940. (*     DOS Object Management *)
  1941.  
  1942. LIBCALL (base : DosLibraryPtr) DupLockFromFH*
  1943.   ( fh [1] : FileHandlePtr )
  1944.   : FileLockPtr;
  1945.   -372;
  1946. LIBCALL (base : DosLibraryPtr) OpenFromLock*
  1947.   ( lock [1] : FileLockPtr )
  1948.   : FileHandlePtr;
  1949.   -378;
  1950. LIBCALL (base : DosLibraryPtr) ParentOfFH*
  1951.   ( fh [1] : FileHandlePtr )
  1952.   : FileLockPtr;
  1953.   -384;
  1954. LIBCALL (base : DosLibraryPtr) ExamineFH*
  1955.   ( fh      [1] : FileHandlePtr;
  1956.     VAR fib [2] : FileInfoBlock )
  1957.   : BOOLEAN;
  1958.   -390;
  1959. LIBCALL (base : DosLibraryPtr) SetFileDate*
  1960.   ( name     [1] : ARRAY OF CHAR;
  1961.     VAR date [2] : Date )
  1962.   : BOOLEAN;
  1963.   -396;
  1964. LIBCALL (base : DosLibraryPtr) NameFromLock*
  1965.   ( lock       [1] : FileLockPtr;
  1966.     VAR buffer [2] : ARRAY OF CHAR;
  1967.     len        [3] : LONGINT)
  1968.   : BOOLEAN;
  1969.   -402;
  1970. LIBCALL (base : DosLibraryPtr) NameFromFH*
  1971.   ( fh         [1] : FileHandlePtr;
  1972.     VAR buffer [2] : ARRAY OF CHAR;
  1973.     len        [3] : LONGINT)
  1974.   : BOOLEAN;
  1975.   -408;
  1976. LIBCALL (base : DosLibraryPtr) SplitName*
  1977.   ( name      [1] : ARRAY OF CHAR;
  1978.     seperator [2] : CHAR;
  1979.     VAR buf   [3] : ARRAY OF CHAR;
  1980.     oldpos    [4] : LONGINT;
  1981.     size      [5] : LONGINT)
  1982.   : INTEGER;
  1983.   -414;
  1984. LIBCALL (base : DosLibraryPtr) SameLock*
  1985.   ( lock1 [1] : FileLockPtr;
  1986.     lock2 [2] : FileLockPtr )
  1987.   : INTEGER;
  1988.   -420;
  1989. LIBCALL (base : DosLibraryPtr) SetMode*
  1990.   ( fh   [1] : FileHandlePtr;
  1991.     mode [2] : LONGINT)
  1992.   : BOOLEAN;
  1993.   -426;
  1994. LIBCALL (base : DosLibraryPtr) ExAll*
  1995.   ( lock    [1] : FileLockPtr;
  1996.     buffer  [2] : ARRAY OF SYS.BYTE;
  1997.     size    [3] : LONGINT;
  1998.     data    [4] : LONGINT;
  1999.     control [5] : ExAllControlPtr )
  2000.   : BOOLEAN;
  2001.   -432;
  2002. LIBCALL (base : DosLibraryPtr) ReadLink*
  2003.   ( port       [1] : ProcessId;
  2004.     lock       [2] : FileLockPtr;
  2005.     path       [3] : ARRAY OF CHAR;
  2006.     VAR buffer [4] : ARRAY OF CHAR;
  2007.     size       [5] : E.ULONG )
  2008.   : LONGINT;
  2009.   -438;
  2010. LIBCALL (base : DosLibraryPtr) MakeLink*
  2011.   ( name [1] : ARRAY OF CHAR;
  2012.     dest [2] : LONGINT;
  2013.     soft [3] : LONGINT)
  2014.   : LONGINT;
  2015.   -444;
  2016. LIBCALL (base : DosLibraryPtr) ChangeMode*
  2017.   ( type    [1] : LONGINT; (* must be changeFH *)
  2018.     fh      [2] : FileHandlePtr;
  2019.     newmode [3] : LONGINT)
  2020.   : BOOLEAN;
  2021.   -450;
  2022. LIBCALL (base : DosLibraryPtr) ChangeModeLock*
  2023.   ( type    [1] : LONGINT; (* must be changeLock *)
  2024.     fh      [2] : FileLockPtr;
  2025.     newmode [3] : LONGINT)
  2026.   : BOOLEAN;
  2027.   -450;
  2028. LIBCALL (base : DosLibraryPtr) SetFileSize*
  2029.   ( fh   [1] : FileHandlePtr;
  2030.     pos  [2] : LONGINT;
  2031.     mode [3] : LONGINT)
  2032.   : LONGINT;
  2033.   -456;
  2034.  
  2035. (*      Error Handling *)
  2036.  
  2037. LIBCALL (base : DosLibraryPtr) SetIoErr*
  2038.   ( result [1] : LONGINT)
  2039.   : LONGINT;
  2040.   -462;
  2041. LIBCALL (base : DosLibraryPtr) Fault*
  2042.   ( code       [1] : LONGINT;
  2043.     header     [2] : ARRAY OF CHAR;
  2044.     VAR buffer [3] : ARRAY OF CHAR;
  2045.     len        [4] : LONGINT)
  2046.   : LONGINT;
  2047.   -468;
  2048. LIBCALL (base : DosLibraryPtr) PrintFault*
  2049.   ( code   [1] : LONGINT;
  2050.     header [2] : ARRAY OF CHAR )
  2051.   : BOOLEAN;
  2052.   -474;
  2053. LIBCALL (base : DosLibraryPtr) ErrorReport*
  2054.   ( code   [1] : LONGINT;
  2055.     type   [2] : LONGINT;
  2056.     arg1   [3] : DeviceListAPtr;
  2057.     device [8] : ProcessId )
  2058.   : LONGINT;
  2059.   -480;
  2060. LIBCALL (base : DosLibraryPtr) ErrorReportLock*
  2061.   ( code   [1] : LONGINT;
  2062.     type   [2] : LONGINT;
  2063.     arg1   [3] : FileLockPtr;
  2064.     device [8] : ProcessId )
  2065.   : LONGINT;
  2066.   -480;
  2067. LIBCALL (base : DosLibraryPtr) ErrorReportFH*
  2068.   ( code   [1] : LONGINT;
  2069.     type   [2] : LONGINT;
  2070.     arg1   [3] : FileHandlePtr;
  2071.     device [8] : ProcessId )
  2072.   : LONGINT;
  2073.   -480;
  2074.  
  2075. (*      Process Management *)
  2076.  
  2077. LIBCALL (base : DosLibraryPtr) Cli* ()
  2078.   : CommandLineInterfaceAPtr;
  2079.   -492;
  2080. LIBCALL (base : DosLibraryPtr) CreateNewProc*
  2081.   ( tags [1] : ARRAY OF U.TagItem )
  2082.   : ProcessPtr;
  2083.   -498;
  2084. LIBCALL (base : DosLibraryPtr) CreateNewProcTags*
  2085.   ( tags [1].. : U.Tag )
  2086.   : ProcessPtr;
  2087.   -498;
  2088. LIBCALL (base : DosLibraryPtr) RunCommand*
  2089.   ( seg      [1] : BPTR;
  2090.     stack    [2] : LONGINT;
  2091.     paramptr [3] : ARRAY OF CHAR;
  2092.     paramlen [4] : LONGINT)
  2093.   : LONGINT;
  2094.   -504;
  2095. LIBCALL (base : DosLibraryPtr) GetConsoleTask* ()
  2096.   : ProcessId;
  2097.   -510;
  2098. LIBCALL (base : DosLibraryPtr) SetConsoleTask*
  2099.   ( task [1] : ProcessId )
  2100.   : ProcessId;
  2101.   -516;
  2102. LIBCALL (base : DosLibraryPtr) GetFileSysTask* ()
  2103.   : ProcessId;
  2104.   -522;
  2105. LIBCALL (base : DosLibraryPtr) SetFileSysTask*
  2106.   ( task [1] : ProcessId )
  2107.   : ProcessId;
  2108.   -528;
  2109. LIBCALL (base : DosLibraryPtr) GetArgStr* ()
  2110.   : E.STRPTR;
  2111.   -534;
  2112. LIBCALL (base : DosLibraryPtr) SetArgStr*
  2113.   ( string [1] : ARRAY OF CHAR )
  2114.   : E.STRPTR;
  2115.   -540;
  2116. LIBCALL (base : DosLibraryPtr) FindCliProc*
  2117.   ( num [1] : E.ULONG )
  2118.   : ProcessPtr;
  2119.   -546;
  2120. LIBCALL (base : DosLibraryPtr) MaxCli* ()
  2121.   : E.ULONG;
  2122.   -552;
  2123. LIBCALL (base : DosLibraryPtr) SetCurrentDirName*
  2124.   ( name [1] : ARRAY OF CHAR )
  2125.   : BOOLEAN;
  2126.   -558;
  2127. LIBCALL (base : DosLibraryPtr) GetCurrentDirName*
  2128.   ( VAR buf [1] : ARRAY OF CHAR;
  2129.     len     [2] : LONGINT)
  2130.   : BOOLEAN;
  2131.   -564;
  2132. LIBCALL (base : DosLibraryPtr) SetProgramName*
  2133.   ( name [1] : ARRAY OF CHAR )
  2134.   : BOOLEAN;
  2135.   -570;
  2136. LIBCALL (base : DosLibraryPtr) GetProgramName*
  2137.   ( VAR buf [1] : ARRAY OF CHAR;
  2138.     len     [2] : LONGINT)
  2139.   : BOOLEAN;
  2140.   -576;
  2141. LIBCALL (base : DosLibraryPtr) SetPrompt*
  2142.   ( name [1] : ARRAY OF CHAR )
  2143.   : BOOLEAN;
  2144.   -582;
  2145. LIBCALL (base : DosLibraryPtr) GetPrompt*
  2146.   ( VAR buf [1] : ARRAY OF CHAR;
  2147.     len     [2] : LONGINT)
  2148.   : BOOLEAN;
  2149.   -588;
  2150. LIBCALL (base : DosLibraryPtr) SetProgramDir*
  2151.   ( lock [1] : FileLockPtr )
  2152.   : FileLockPtr;
  2153.   -594;
  2154. LIBCALL (base : DosLibraryPtr) GetProgramDir* ()
  2155.   : FileLockPtr;
  2156.   -600;
  2157.  
  2158. (*      Device List Management *)
  2159.  
  2160. LIBCALL (base : DosLibraryPtr) System*
  2161.   ( command [1] : ARRAY OF CHAR;
  2162.     tags    [2] : ARRAY OF U.TagItem )
  2163.   : LONGINT;
  2164.   -606;
  2165. LIBCALL (base : DosLibraryPtr) SystemTags*
  2166.   ( command [1]   : ARRAY OF CHAR;
  2167.     tags    [2].. : U.Tag )
  2168.   : LONGINT;
  2169.   -606;
  2170. LIBCALL (base : DosLibraryPtr) AssignLock*
  2171.   ( name [1] : ARRAY OF CHAR;
  2172.     lock [2] : FileLockPtr )
  2173.   : BOOLEAN;
  2174.   -612;
  2175. LIBCALL (base : DosLibraryPtr) AssignLate*
  2176.   ( name [1] : ARRAY OF CHAR;
  2177.     path [2] : ARRAY OF CHAR )
  2178.   : BOOLEAN;
  2179.   -618;
  2180. LIBCALL (base : DosLibraryPtr) AssignPath*
  2181.   ( name [1] : ARRAY OF CHAR;
  2182.     path [2] : ARRAY OF CHAR )
  2183.   : BOOLEAN;
  2184.   -624;
  2185. LIBCALL (base : DosLibraryPtr) AssignAdd*
  2186.   ( name [1] : ARRAY OF CHAR;
  2187.     lock [2] : FileLockPtr )
  2188.   : BOOLEAN;
  2189.   -630;
  2190. LIBCALL (base : DosLibraryPtr) RemAssignList*
  2191.   ( name [1] : ARRAY OF CHAR;
  2192.     lock [2] : FileLockPtr )
  2193.   : LONGINT;
  2194.   -636;
  2195. LIBCALL (base : DosLibraryPtr) GetDeviceProc*
  2196.   ( name [1] : ARRAY OF CHAR;
  2197.     dp   [2] : DevProcPtr )
  2198.   : DevProcPtr;
  2199.   -642;
  2200. LIBCALL (base : DosLibraryPtr) FreeDeviceProc*
  2201.   ( dp [1] : DevProcPtr );
  2202.   -648;
  2203. LIBCALL (base : DosLibraryPtr) LockDosList*
  2204.   ( flags [1] : SET )
  2205.   : DosListNodePtr;
  2206.   -654;
  2207. LIBCALL (base : DosLibraryPtr) UnLockDosList*
  2208.   ( flags [1] : SET );
  2209.   -660;
  2210. LIBCALL (base : DosLibraryPtr) AttemptLockDosList*
  2211.   ( flags [1] : SET )
  2212.   : DosListNodePtr;
  2213.   -666;
  2214. LIBCALL (base : DosLibraryPtr) RemDosEntry*
  2215.   ( dlist [1] : DosListNodePtr )
  2216.   : BOOLEAN;
  2217.   -672;
  2218. LIBCALL (base : DosLibraryPtr) AddDosEntry*
  2219.   ( dlist [1] : DosListNodePtr )
  2220.   : DosListNodePtr;
  2221.   -678;
  2222. LIBCALL (base : DosLibraryPtr) FindDosEntry*
  2223.   ( dlist [1] : DosListNodePtr;
  2224.     name  [2] : ARRAY OF CHAR;
  2225.     flags [3] : SET )
  2226.   : DosListNodePtr;
  2227.   -684;
  2228. LIBCALL (base : DosLibraryPtr) NextDosEntry*
  2229.   ( dlist [1] : DosListNodePtr;
  2230.     flags [2] : SET )
  2231.   : DosListNodePtr;
  2232.   -690;
  2233. LIBCALL (base : DosLibraryPtr) MakeDosEntry*
  2234.   ( name [1] : ARRAY OF CHAR;
  2235.     type [2] : LONGINT)
  2236.   : DosListNodePtr;
  2237.   -696;
  2238. LIBCALL (base : DosLibraryPtr) FreeDosEntry*
  2239.   ( dlist [1] : DosListNodePtr );
  2240.   -702;
  2241. LIBCALL (base : DosLibraryPtr) IsFileSystem*
  2242.   ( name [1] : ARRAY OF CHAR )
  2243.   : BOOLEAN;
  2244.   -708;
  2245.  
  2246. (*      Handler Interface *)
  2247.  
  2248. LIBCALL (base : DosLibraryPtr) Format*
  2249.   ( filesystem [1] : ARRAY OF CHAR;
  2250.     volumename [2] : ARRAY OF CHAR;
  2251.     dostype    [3] : E.ULONG )
  2252.   : BOOLEAN;
  2253.   -714;
  2254. LIBCALL (base : DosLibraryPtr) Relabel*
  2255.   ( drive   [1] : ARRAY OF CHAR;
  2256.     newname [2] : ARRAY OF CHAR )
  2257.   : BOOLEAN;
  2258.   -720;
  2259. LIBCALL (base : DosLibraryPtr) Inhibit*
  2260.   ( name  [1] : ARRAY OF CHAR;
  2261.     onoff [2] : LONGINT)
  2262.   : BOOLEAN;
  2263.   -726;
  2264. LIBCALL (base : DosLibraryPtr) AddBuffers*
  2265.   ( name   [1] : ARRAY OF CHAR;
  2266.     number [2] : LONGINT)
  2267.   : BOOLEAN;
  2268.   -732;
  2269.  
  2270. (*      Date, Time Routines *)
  2271.  
  2272. LIBCALL (base : DosLibraryPtr) CompareDates*
  2273.   ( VAR date1 [1] : Date;
  2274.     VAR date2 [2] : Date )
  2275.   : LONGINT;
  2276.   -738;
  2277. LIBCALL (base : DosLibraryPtr) DateToStr*
  2278.   ( VAR datetime [1] : DateTime )
  2279.   : BOOLEAN;
  2280.   -744;
  2281. LIBCALL (base : DosLibraryPtr) StrToDate*
  2282.   ( VAR datetime [1] : DateTime )
  2283.   : BOOLEAN;
  2284.   -750;
  2285.  
  2286. (*      Image Management *)
  2287.  
  2288. LIBCALL (base : DosLibraryPtr) InternalLoadSeg*
  2289.   ( fh         [1] : FileHandlePtr;
  2290.     table      [8] : BPTR;
  2291.     funcarray  [9] : E.APTR;
  2292.     VAR stack [10] : LONGINT )
  2293.   : BPTR;
  2294.   -756;
  2295. LIBCALL (base : DosLibraryPtr) InternalUnLoadSeg*
  2296.   ( seglist  [1] : BPTR;
  2297.     freefunc [9] : E.PROC )
  2298.   : BOOLEAN;
  2299.   -762;
  2300. LIBCALL (base : DosLibraryPtr) NewLoadSeg*
  2301.   ( file [1] : ARRAY OF CHAR;
  2302.     tags [2] : ARRAY OF U.TagItem )
  2303.   : BPTR;
  2304.   -768;
  2305. LIBCALL (base : DosLibraryPtr) NewLoadSegTags*
  2306.   ( file [1]   : ARRAY OF CHAR;
  2307.     tags [2].. : U.Tag )
  2308.   : BPTR;
  2309.   -768;
  2310. LIBCALL (base : DosLibraryPtr) AddSegment*
  2311.   ( name   [1] : ARRAY OF CHAR;
  2312.     seg    [2] : BPTR;
  2313.     system [3] : LONGINT)
  2314.   : BOOLEAN;
  2315.   -774;
  2316. LIBCALL (base : DosLibraryPtr) FindSegment*
  2317.   ( name   [1] : ARRAY OF CHAR;
  2318.     seg    [2] : SegmentPtr;
  2319.     system [3] : LONGINT)
  2320.   : SegmentPtr;
  2321.   -780;
  2322. LIBCALL (base : DosLibraryPtr) RemSegment*
  2323.   ( seg [1] : SegmentPtr )
  2324.   : BOOLEAN;
  2325.   -786;
  2326.  
  2327. (*      Command Support *)
  2328.  
  2329. LIBCALL (base : DosLibraryPtr) CheckSignal*
  2330.   ( mask [1] : SET)
  2331.   : SET;
  2332.   -792;
  2333. LIBCALL (base : DosLibraryPtr) ReadArgs*
  2334.   ( template  [1] : ARRAY OF CHAR;
  2335.     VAR array [2] : ARRAY OF SYS.LONGWORD;
  2336.     args      [3] : RDArgsPtr )
  2337.   : RDArgsPtr;
  2338.   -798;
  2339. LIBCALL (base : DosLibraryPtr) FindArg*
  2340.   ( template [1] : ARRAY OF CHAR;
  2341.     keyword  [2] : ARRAY OF CHAR )
  2342.   : LONGINT;
  2343.   -804;
  2344. LIBCALL (base : DosLibraryPtr) ReadItem*
  2345.   ( VAR name [1] : ARRAY OF CHAR;
  2346.     maxchars [2] : LONGINT;
  2347.     cSource  [3] : CSourcePtr )
  2348.   : LONGINT;
  2349.   -810;
  2350. LIBCALL (base : DosLibraryPtr) StrToLong*
  2351.   ( string    [1] : ARRAY OF CHAR;
  2352.     VAR value [2] : LONGINT )
  2353.   : LONGINT;
  2354.   -816;
  2355. LIBCALL (base : DosLibraryPtr) MatchFirst*
  2356.   ( pat        [1] : ARRAY OF CHAR;
  2357.     VAR anchor [2] : AnchorPath )
  2358.   : LONGINT;
  2359.   -822;
  2360. LIBCALL (base : DosLibraryPtr) MatchNext*
  2361.   ( VAR anchor [1] : AnchorPath )
  2362.   : LONGINT;
  2363.   -828;
  2364. LIBCALL (base : DosLibraryPtr) MatchEnd*
  2365.   ( VAR anchor [1] : AnchorPath );
  2366.   -834;
  2367. LIBCALL (base : DosLibraryPtr) ParsePattern*
  2368.   ( pat     [1] : ARRAY OF CHAR;
  2369.     VAR buf [2] : ARRAY OF CHAR;
  2370.     buflen  [3] : LONGINT)
  2371.   : INTEGER;
  2372.   -840;
  2373. LIBCALL (base : DosLibraryPtr) MatchPattern*
  2374.   ( pat [1] : ARRAY OF CHAR;
  2375.     str [2] : ARRAY OF CHAR )
  2376.   : BOOLEAN;
  2377.   -846;
  2378. LIBCALL (base : DosLibraryPtr) FreeArgs*
  2379.   ( args [1] : RDArgsPtr );
  2380.   -858;
  2381. LIBCALL (base : DosLibraryPtr) FilePart*
  2382.   ( path [1] : ARRAY OF CHAR )
  2383.   : E.STRPTR;
  2384.   -870;
  2385. LIBCALL (base : DosLibraryPtr) PathPart*
  2386.   ( path [1] : ARRAY OF CHAR )
  2387.   : E.STRPTR;
  2388.   -876;
  2389. LIBCALL (base : DosLibraryPtr) AddPart*
  2390.   ( VAR dirname [1] : ARRAY OF CHAR;
  2391.     filename    [2] : ARRAY OF CHAR;
  2392.     size        [3] : E.ULONG )
  2393.   : BOOLEAN;
  2394.   -882;
  2395.  
  2396. (*      Notification *)
  2397.  
  2398. LIBCALL (base : DosLibraryPtr) StartNotify*
  2399.   ( VAR notify [1] : NotifyRequest )
  2400.   : BOOLEAN;
  2401.   -888;
  2402. LIBCALL (base : DosLibraryPtr) EndNotify*
  2403.   ( VAR notify [1] : NotifyRequest );
  2404.   -894;
  2405.  
  2406. (*      Environment Variable functions *)
  2407.  
  2408. LIBCALL (base : DosLibraryPtr) SetVar*
  2409.   ( name       [1] : ARRAY OF CHAR;
  2410.     VAR buffer [2] : ARRAY OF CHAR;
  2411.     size       [3] : LONGINT;
  2412.     flags      [4] : SET)
  2413.   : BOOLEAN;
  2414.   -900;
  2415. LIBCALL (base : DosLibraryPtr) GetVar*
  2416.   ( name       [1] : ARRAY OF CHAR;
  2417.     VAR buffer [2] : ARRAY OF CHAR;
  2418.     size       [3] : LONGINT;
  2419.     flags      [4] : SET)
  2420.   : LONGINT;
  2421.   -906;
  2422. LIBCALL (base : DosLibraryPtr) DeleteVar*
  2423.   ( name  [1] : ARRAY OF CHAR;
  2424.     flags [2] : SET )
  2425.   : BOOLEAN;
  2426.   -912;
  2427. LIBCALL (base : DosLibraryPtr) FindVar*
  2428.   ( name [1] : ARRAY OF CHAR;
  2429.     type [2] : SET )
  2430.   : LocalVarPtr;
  2431.   -918;
  2432. LIBCALL (base : DosLibraryPtr) CliInit*
  2433.   ( VAR dp [8] : DosPacket )
  2434.   : SET;
  2435.   -924;
  2436. LIBCALL (base : DosLibraryPtr) CliInitNewcli*
  2437.   ( VAR dp [8] : DosPacket )
  2438.   : SET;
  2439.   -930;
  2440. LIBCALL (base : DosLibraryPtr) CliInitRun*
  2441.   ( VAR dp [8] : DosPacket )
  2442.   : SET;
  2443.   -936;
  2444. LIBCALL (base : DosLibraryPtr) WriteChars*
  2445.   ( buf    [1] : ARRAY OF CHAR;
  2446.     buflen [2] : LONGINT )
  2447.   : LONGINT;
  2448.   -942;
  2449. LIBCALL (base : DosLibraryPtr) PutStr*
  2450.   ( str [1] : ARRAY OF CHAR )
  2451.   : LONGINT;
  2452.   -948;
  2453. LIBCALL (base : DosLibraryPtr) VPrintf*
  2454.   ( format   [1] : ARRAY OF CHAR;
  2455.     argarray [2] : ARRAY OF SYS.LONGWORD )
  2456.   : LONGINT;
  2457.   -954;
  2458. LIBCALL (base : DosLibraryPtr) Printf*
  2459.   ( format   [1]   : ARRAY OF CHAR;
  2460.     argarray [2].. : SYS.LONGWORD )
  2461.   : LONGINT;
  2462.   -954;
  2463. LIBCALL (base : DosLibraryPtr) PrintF*
  2464.   ( format   [1]   : ARRAY OF CHAR;
  2465.     argarray [2].. : SYS.LONGWORD );
  2466.   -954;
  2467.  
  2468. (* these were unimplemented until dos 36.147 *)
  2469.  
  2470. LIBCALL (base : DosLibraryPtr) ParsePatternNoCase*
  2471.   ( pat     [1] : ARRAY OF CHAR;
  2472.     VAR buf [2] : ARRAY OF CHAR;
  2473.     buflen  [3] : LONGINT)
  2474.   : INTEGER;
  2475.   -966;
  2476. LIBCALL (base : DosLibraryPtr) MatchPatternNoCase*
  2477.   ( pat [1] : ARRAY OF CHAR;
  2478.     str [2] : ARRAY OF CHAR )
  2479.   : BOOLEAN;
  2480.   -972;
  2481.  
  2482. (* this was added for V37 dos; returned 0 before then. *)
  2483.  
  2484. LIBCALL (base : DosLibraryPtr) SameDevice*
  2485.   ( lock1 [1] : FileLockPtr;
  2486.     lock2 [2] : FileLockPtr )
  2487.   : BOOLEAN;
  2488.   -984;
  2489.  
  2490. (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
  2491. (* If you are going to use them, open dos.library with version 37 *)
  2492.  
  2493. (* These calls were added for V39 dos: *)
  2494. LIBCALL (base : DosLibraryPtr) ExAllEnd  *
  2495.   ( lock    [1] : FileLockPtr;
  2496.     buffer  [2] : ARRAY OF SYS.BYTE;
  2497.     size    [3] : LONGINT;
  2498.     data    [4] : LONGINT;
  2499.     control [5] : ExAllControlPtr );
  2500.   -990;
  2501. LIBCALL (base : DosLibraryPtr) SetOwner  *
  2502.   ( name      [1] : ARRAY OF CHAR;
  2503.     ownerInfo [2] : LONGINT)
  2504.   : BOOLEAN;
  2505.   -996;
  2506.  
  2507. (**-- C Macros ---------------------------------------------------------*)
  2508.  
  2509. (*
  2510. **      $VER: stdio.h 36.6 (1.11.91)
  2511. **
  2512. **      ANSI-like stdio defines for dos buffered I/O
  2513. *)
  2514.  
  2515. PROCEDURE ReadChar * () : CHAR;
  2516.   VAR c : LONGINT;
  2517. BEGIN
  2518.   c := base.FGetC (base.Input());
  2519.   IF (c < 0) OR (c > 255) THEN c := 0 END;
  2520.   RETURN CHR(c)
  2521. END ReadChar;
  2522.  
  2523. PROCEDURE WriteChar * ( c : CHAR ) : LONGINT;
  2524. BEGIN
  2525.   RETURN base.FPutC (base.Output (), ORD (c))
  2526. END WriteChar;
  2527.  
  2528. PROCEDURE UnReadChar * ( c : CHAR ) : LONGINT;
  2529. BEGIN
  2530.   RETURN base.UnGetC (base.Input(), ORD(c))
  2531. END UnReadChar;
  2532.  
  2533. (* next one is inefficient *)
  2534.  
  2535. PROCEDURE ReadChars *
  2536.   (VAR buf : ARRAY OF SYS.BYTE; num : LONGINT)
  2537.   : LONGINT;
  2538. BEGIN
  2539.   RETURN base.FRead (base.Input (), buf, 1, num)
  2540. END ReadChars;
  2541.  
  2542. PROCEDURE ReadLn * (VAR buf : ARRAY OF CHAR; len : LONGINT) : E.APTR;
  2543. BEGIN
  2544.   RETURN base.FGets (base.Input (), buf, len)
  2545. END ReadLn;
  2546.  
  2547. PROCEDURE WriteStr * (s : ARRAY OF CHAR) : BOOLEAN;
  2548. (* $D- *)
  2549. BEGIN
  2550.   RETURN base.FPuts (base.Output (), s)
  2551. END WriteStr;
  2552.  
  2553. PROCEDURE VWritef *
  2554.   (format : ARRAY OF CHAR; argv : ARRAY OF SYS.LONGWORD)
  2555.   : LONGINT;
  2556. (* $D- *)
  2557. BEGIN
  2558.   RETURN base.VFWritef (base.Output(), format, argv)
  2559. END VWritef;
  2560.  
  2561. (**-- Library Base variable --------------------------------------------*)
  2562. (* $L- *)
  2563.  
  2564. PROCEDURE* Close ();
  2565.  
  2566. BEGIN (* Close *)
  2567.   IF base # NIL THEN E.base.CloseLibrary (base) END;
  2568. END Close;
  2569.  
  2570. BEGIN (* Dos *)
  2571.   base :=
  2572.     SYS.VAL (
  2573.       DosLibraryPtr,
  2574.       E.base.OpenLibrary (name, E.libraryMinimum));
  2575.   IF base = NIL THEN HALT (100) END;
  2576.   SYS.SETCLEANUP (Close)
  2577. END Dos.
  2578.